cloudflare/agents
Build and deploy AI Agents on Cloudflare
https://skillcdn.ai/gh/cloudflare/agentsConnect this address to your AI to use these skills. How to connect
- Unverified
- Default branch
main - Commit
bdb20e4 - License
MIT - Searchwords
Showing commit bdb20e4
The newest commit, 3f2091c, is being indexed. Until it is ready, this page and every agent are served the last indexed commit.
This repository is larger than the indexing limits, so some files are missing from the index.
Explore this repository
Searches the original text of skills and documents, and the translations of skills when you search in their language.
Folders
Documents
- Adding Agents to an Existing ProjectThis guide shows how to add agents to an existing Cloudflare Workers project. If you're starting fresh, see Getting Started instead.docs/agents/adding-to-existing-project.md
- Demystifying the Agent classThe core of the agents library is the exported Agent class. Following the pattern from Durable Objects, the main API for developers is to extend the Agent so those classes inherit all the built-in fe…docs/agents/agent-class.md
- Agent ToolsAgent tools let one chat agent dispatch another chat-capable sub-agent as part of its work — per-run, parent-supervised delegation is the flagship use case for facet-backed dynamic agents. The child…docs/agents/agent-tools.md
- Browse the WebBrowser tools give your agents the full Chrome DevTools Protocol (CDP). Instead of a fixed set of actions (click, screenshot, navigate), the model writes code that sends CDP commands to a live browse…docs/agents/browse-the-web.md
- Callable MethodsCallable methods let clients invoke agent methods over WebSocket using RPC (Remote Procedure Call). Mark methods with @callable() to expose them to external clients like browsers, mobile apps, or oth…docs/agents/callable-methods.md
- Chat AgentsBuild AI-powered chat interfaces with AIChatAgent and useAgentChat. Messages are automatically persisted to SQLite, streams resume on disconnect, and tool calls work across server and client.docs/agents/chat-agents.md
- Chat SDK stateUse agents/chat-sdk when you run the Chat SDK inside an Agent and want the Chat SDK StateAdapter to use Agents sub-agents for durable state.docs/agents/chat-sdk.md
- Client SDKConnect to agents from any JavaScript runtime — browsers, Node.js, Deno, Bun, or edge functions — using WebSockets or HTTP. The SDK provides real-time state synchronization, RPC method calls, and str…docs/agents/client-sdk.md
- Client-Side Tools and Auto-ContinuationTools in AIChatAgent can be divided into two categories:docs/agents/client-tools-continuation.md
- Codemode (Experimental)Codemode lets LLMs write and execute code that orchestrates your tools, instead of calling them one at a time. Inspired by CodeAct, it works because LLMs are better at writing code than making indivi…docs/agents/codemode.md
- ConfigurationThis guide covers everything you need to configure agents for local development and production deployment, including wrangler.jsonc setup, type generation, environment variables, and the Cloudflare d…docs/agents/configuration.md
- Cross-Domain AuthenticationWhen your Agents are deployed, to keep things secure, send a token from the client, then verify it on the server. This mirrors the shape used in PartyKit’s auth guide.docs/agents/cross-domain-authentication.md
- Durable ExecutionRun work that survives Durable Object eviction. runFiber() registers a task in SQLite, keeps the agent alive during execution, lets you checkpoint intermediate state with stash(), and calls onFiberRe…docs/agents/durable-execution.md
- Email ServiceAgents can send and receive email with Cloudflare's Email Service. This guide shows how to send outbound email with the Workers binding, route inbound mail into Agents, and handle follow-up replies s…docs/agents/email.md
- Fetch the Web (Beta)agents/webfetch gives a model a web_fetch tool that reads one URL and returns the most useful text form of it: Markdown for HTML pages, PDFs, and Office documents, pretty-printed JSON, or plain text…docs/agents/fetch-the-web.md
- `getCurrentAgent()`The framework detects and wraps custom Agent methods during initialization so getCurrentAgent() can resolve the active agent inside them and the functions they call.docs/agents/get-current-agent.md
- Getting StartedBuild AI agents that persist, think, and act. Agents run on Cloudflare's global network, maintain state across requests, and connect to clients in real-time via WebSockets.docs/agents/getting-started.md
- HTTP & WebSocketsAgents handle both HTTP requests and WebSocket connections, giving you flexibility to build REST APIs, real-time applications, or hybrid architectures.docs/agents/http-websockets.md
- Human in the LoopHuman-in-the-loop (HITL) patterns allow agents to pause execution and wait for human approval, confirmation, or input before proceeding. This is essential for compliance, safety, and oversight in age…docs/agents/human-in-the-loop.md
- Agents DocumentationBuild stateful AI agents on Cloudflare Workers. An agent is a Durable Object: an addressable actor with its own SQLite database, alarms, and WebSockets. You can run one durable agent per user, accoun…docs/agents/index.md
- Durable Object lifecycleagents/lifecycle is stable. Most capabilities built on it are still experimental; each capability's page says which.docs/agents/lifecycle.md
- Long-Running AgentsBuild agents that persist for days, weeks, or months — surviving restarts, waking on demand, and managing work that spans far longer than any single request.docs/agents/long-running-agents.md
- Connecting to MCP ServersConnect your agent to external MCP (Model Context Protocol) servers to use their tools, resources, and prompts. This enables your agent to interact with GitHub, Slack, databases, and other services t…docs/agents/mcp-client.md
- Creating MCP ServersBuild an MCP server on Workers with createMcpHandler from agents/mcp/server and an MCP SDK v2 McpServer. The handler is stateless: every request gets a fresh server from your factory, so there is no…docs/agents/mcp-servers.md
- MCP TransportsThis page covers the transport your MCP server uses and the transports an Agent can use to connect to other MCP servers.docs/agents/mcp-transports.md
- Migrating from AI SDK v4 to v5This guide covers the changes needed when upgrading from AI SDK v4 to v5 with @cloudflare/ai-chat.docs/agents/migration-to-ai-sdk-v5.md
- Migrating from AI SDK v5 to v6This guide covers the changes needed when upgrading from AI SDK v5 to v6 with @cloudflare/ai-chat.docs/agents/migration-to-ai-sdk-v6.md
- Models for pi-aiagents/models/pi-ai is the pi-ai twin of agents/models/ai-sdk: the same createAI factory, the same options, the same gateway, returning pi-ai Model objects instead of AI SDK ones. Use it with pi-ai's…docs/agents/models-pi-ai.md
- Modelsagents/models/ai-sdk is Cloudflare's AI SDK provider. It takes two call forms, through the AI binding or an account id and API token:docs/agents/models.md
- ObservabilityAgents emit structured events for every significant operation — RPC calls, state changes, schedule execution, workflow transitions, MCP connections, and more. These events are published to diagnostic…docs/agents/observability.md
- Push NotificationsSend browser push notifications from your agent — even when the user has closed the tab. By combining the agent's persistent state (for storing push subscriptions), scheduling (for timed delivery), a…docs/agents/push-notifications.md
- QueueDurable background work for an Agent or any Lifecycle Object. A queued item persists a callback name and a payload, runs from the Durable Object's alarm loop one item at a time in push order, retries…docs/agents/queue.md
- Readonly ConnectionsReadonly connections restrict certain WebSocket clients from modifying agent state while still letting them receive state updates and call non-mutating RPC methods.docs/agents/readonly-connections.md
- Resumable StreamingThe AIChatAgent class provides automatic resumable streaming out of the box. When a client disconnects and reconnects during an active stream, the response automatically resumes from where it left of…docs/agents/resumable-streaming.md
- RetriesRetry failed operations with exponential backoff and jitter. The Agents SDK provides built-in retry support for scheduled tasks, queued tasks, and a general-purpose this.retry() method for your own c…docs/agents/retries.md
- RoutingThis guide explains how requests are routed to agents, how naming works, and patterns for organizing your agents.docs/agents/routing.md
- SchedulingSchedule tasks to run in the future — whether that's seconds from now, at a specific date/time, or on a recurring cron schedule. Scheduled tasks survive agent restarts and are persisted to SQLite.docs/agents/scheduling.md
- Search the Web (Beta)agents/websearch gives a model a web_search tool over Cloudflare's Web Search API, called through the AI binding and billed by the account's AI Gateway. The same tool is available for the pi harness,…docs/agents/search-the-web.md
- Securing MCP ServersMCP servers, like any web application, need to be secured so they can be used by trusted users without abuse. The MCP specification uses OAuth 2.1 for authorization between MCP clients and servers.docs/agents/securing-mcp-servers.md
- Trigger patternsSend messages and trigger LLM responses from the server without a human action. Use this for scheduled follow-ups, queue processing, email-triggered responses, and autonomous agent workflows.docs/agents/server-driven-messages.md
- Sessionsagents/sessions stores durable conversation history in a Lifecycle Object. It provides tree-structured messages, streamed and byte-budgeted reads, compaction overlays, optional full-text search, and…docs/agents/sessions.md
- State ManagementAgents provide built-in state management with automatic persistence and real-time synchronization across all connected clients.docs/agents/state.md
- Streamsagents/streams adds durable incremental output to a Lifecycle Object: an ordered, durable chunk log per stream with a monotonic cursor, replay-then-tail reads, and terminal status. A consumer that re…docs/agents/streams.md
- Dynamic agents (facets)Dynamic agents are child Durable Objects colocated under and supervised by a parent agent, built on the runtime's facet primitive. Each child runs in its own isolate with its own SQLite database, but…docs/agents/sub-agents.md
- Tasksagents/tasks adds durable, replayable background work to a Lifecycle Object. One Tasks capability owns any number of named Task definitions. A run of a definition survives process loss, deployments,…docs/agents/tasks.md
- Voice AgentsBuild real-time voice agents with speech-to-text, text-to-speech, and conversation persistence. Audio streams over WebSocket — no SFU or meeting infrastructure required.docs/agents/voice.md
- WebhooksReceive webhook events from external services and route them to dedicated agent instances. Each webhook source (repository, customer, device) can have its own agent with isolated state, persistent st…docs/agents/webhooks.md
- Workflows IntegrationIntegrate Cloudflare Workflows with Agents for durable, multi-step background processing while Agents handle real-time communication.docs/agents/workflows.md
Skipped (10)
These manifests were not served. Fix them and push: the next commit is indexed again.
README.mdlink_missing57 links name no file of the repository (packages/agents, packages/ai-chat, packages/think, ...)docs/agents/index.mdlink_missing15 links name no file of the repository (./sms.md, ./sql.md, ./memory.md, ...)docs/agents/routing.mdlink_missinga link names no file of the repository (/securing-agents)design/rfc-chat-recovery-foundation.mdlink_missing3 links name no file of the repository (../packages/agents/src/chat/turn-queue.ts, ../packages/agents/src/chat/submit-concurrency.ts, ../packages/agents/src/chat/resumable-stream.ts)design/rfc-workers-ai-gateway-merge.mdlink_missinga link names no file of the repository (10866ae4-99d9-4ffe-a8d7-8ab0b183b494)design/rfc-think-multi-session.mdlink_missinga link names no file of the repository (./think-sessions.md)design/rfc-user-chat-durable-objects.mdlink_missing2 links name no file of the repository (../examples/next/routing, ../examples/assistant)design/rfc-helper-sub-agent-orchestration.mdlink_missinga link names no file of the repository (../examples/agents-as-tools)examples/next/harnesses/codex/README.mdlink_missinga link names no file of the repository (../../../design/rfc-codex-harness-capability.md)design/think.mdfragment_not_founda link names a section its file does not have (./chat-shared-layer.md#recovery-enginets): a fragment is the words a heading begins with, in lower case and joined by hyphens