# Cloudflare Agents ## Docs - [Introduction to Cloudflare Agents](https://mintlify.wiki/cloudflare/agents/introduction.md): Build AI agents that persist, think, and act on Cloudflare's global network - [Quick Start](https://mintlify.wiki/cloudflare/agents/quickstart.md): Build your first AI agent in 10 minutes - [Adding to Existing Project](https://mintlify.wiki/cloudflare/agents/adding-to-existing-project.md): Integrate agents into your existing Cloudflare Workers application - [Agent Class Architecture](https://mintlify.wiki/cloudflare/agents/core/agent-class.md): Understanding the layers of the Agent class - from Durable Objects to PartyKit Server to Agent - [State Management](https://mintlify.wiki/cloudflare/agents/core/state-management.md): Built-in state management with automatic persistence and real-time synchronization across all connected clients - [Routing](https://mintlify.wiki/cloudflare/agents/core/routing.md): How requests are routed to agents, naming patterns, and URL structures - [Callable Methods](https://mintlify.wiki/cloudflare/agents/core/callable-methods.md): Expose agent methods to external clients over WebSocket using the @callable decorator - [HTTP and WebSockets](https://mintlify.wiki/cloudflare/agents/core/http-websockets.md): Handle HTTP requests and WebSocket connections in your agents - [Configuration](https://mintlify.wiki/cloudflare/agents/core/configuration.md): Configure agents for local development and production deployment with wrangler.jsonc, types, and environment variables - [Client SDK Overview](https://mintlify.wiki/cloudflare/agents/client/client-sdk.md): Connect to agents from any JavaScript runtime using WebSockets or HTTP - [React Hooks](https://mintlify.wiki/cloudflare/agents/client/react-hooks.md): React hook for connecting to agents with automatic state management - [Vanilla JavaScript Client](https://mintlify.wiki/cloudflare/agents/client/vanilla-js.md): Connect to agents from any JavaScript environment with AgentClient and agentFetch - [Chat Agents](https://mintlify.wiki/cloudflare/agents/ai/chat-agents.md): Build AI-powered chat interfaces with automatic message persistence, resumable streaming, and server/client tool support - [Resumable Streaming](https://mintlify.wiki/cloudflare/agents/ai/resumable-streaming.md): Automatic stream resumption when clients disconnect and reconnect during active AI responses - [Client-Side Tools and Auto-Continuation](https://mintlify.wiki/cloudflare/agents/ai/client-tools-continuation.md): Execute tools in the browser and automatically continue LLM conversations in the same turn - [Codemode (Experimental)](https://mintlify.wiki/cloudflare/agents/ai/codemode.md): Let LLMs write and execute code to orchestrate tools in isolated Worker sandboxes - [Creating MCP Servers](https://mintlify.wiki/cloudflare/agents/mcp/creating-servers.md): Learn how to create Model Context Protocol servers with the Agents SDK using different approaches for stateless and stateful implementations. - [Connecting to MCP Servers](https://mintlify.wiki/cloudflare/agents/mcp/connecting-clients.md): Connect your agent to external MCP servers to use their tools, resources, and prompts through a standardized protocol. - [MCP Transports](https://mintlify.wiki/cloudflare/agents/mcp/transports.md): Learn about the different transport options for connecting to MCP servers with the Agents SDK. - [Securing MCP Servers](https://mintlify.wiki/cloudflare/agents/mcp/securing-servers.md): Learn how to secure Model Context Protocol servers with OAuth 2.1, CSRF protection, and security best practices. - [Queue System](https://mintlify.wiki/cloudflare/agents/background/queue.md): Schedule tasks for asynchronous background processing with automatic retries and FIFO ordering - [Scheduling](https://mintlify.wiki/cloudflare/agents/background/scheduling.md): Schedule tasks to run in the future with support for delays, specific times, cron schedules, and intervals - [Workflows Integration](https://mintlify.wiki/cloudflare/agents/background/workflows.md): Integrate Cloudflare Workflows with Agents for durable, multi-step background processing - [Retries](https://mintlify.wiki/cloudflare/agents/background/retries.md): Retry failed operations with exponential backoff and jitter for resilient background processing - [Email Routing](https://mintlify.wiki/cloudflare/agents/channels/email.md): Route inbound emails to your Agents using Cloudflare Email Routing - [Webhooks](https://mintlify.wiki/cloudflare/agents/channels/webhooks.md): Receive webhook events from external services and route them to dedicated agent instances - [Readonly Connections](https://mintlify.wiki/cloudflare/agents/advanced/readonly-connections.md): Restrict WebSocket clients from modifying agent state while still receiving updates - [Cross-Domain Authentication](https://mintlify.wiki/cloudflare/agents/advanced/cross-domain-auth.md): Send and verify tokens for secure cross-domain WebSocket connections - [getCurrentAgent()](https://mintlify.wiki/cloudflare/agents/advanced/get-current-agent.md): Access agent context from external functions and custom methods - [Observability](https://mintlify.wiki/cloudflare/agents/advanced/observability.md): Track RPC calls, state changes, workflows, and other agent operations with structured events - [Human in the Loop](https://mintlify.wiki/cloudflare/agents/advanced/human-in-the-loop.md): Pause agent execution and wait for human approval, confirmation, or input - [Migrating to AI SDK v5](https://mintlify.wiki/cloudflare/agents/migration/ai-sdk-v5.md): Upgrade guide for migrating from AI SDK v4 to v5 with @cloudflare/ai-chat - [Migrating to AI SDK v6](https://mintlify.wiki/cloudflare/agents/migration/ai-sdk-v6.md): Upgrade guide for migrating from AI SDK v5 to v6 with @cloudflare/ai-chat - [Agent](https://mintlify.wiki/cloudflare/agents/api/agent-class.md): Base class for creating Agent implementations with state, RPC, scheduling, and email support - [Routing](https://mintlify.wiki/cloudflare/agents/api/routing.md): Route HTTP requests and emails to Agents - [State Management](https://mintlify.wiki/cloudflare/agents/api/state.md): Manage Agent state with automatic persistence and client synchronization - [@callable Decorator](https://mintlify.wiki/cloudflare/agents/api/callable.md): Mark Agent methods as callable from WebSocket clients via RPC - [AgentClient](https://mintlify.wiki/cloudflare/agents/api/agent-client.md): WebSocket client for connecting to Agents from browsers and Node.js - [useAgent Hook](https://mintlify.wiki/cloudflare/agents/api/use-agent-hook.md): React hook for connecting to Agents with state synchronization and RPC - [useAgentChat Hook](https://mintlify.wiki/cloudflare/agents/api/use-agent-chat-hook.md): React hook for AI chat interfaces with Agents - [McpAgent](https://mintlify.wiki/cloudflare/agents/api/mcp-agent.md): Base class for building MCP (Model Context Protocol) servers - [MCPClientManager](https://mintlify.wiki/cloudflare/agents/api/mcp-client-manager.md): Connect to and manage external MCP servers from Agents - [Scheduling](https://mintlify.wiki/cloudflare/agents/api/scheduling.md): Schedule callbacks to run at future times or on recurring intervals - [AgentWorkflow](https://mintlify.wiki/cloudflare/agents/api/workflows.md): Base class for Workflows that integrate with Agents - [Email Routing](https://mintlify.wiki/cloudflare/agents/api/email.md): Route incoming emails to Agents with secure reply flows - [Observability](https://mintlify.wiki/cloudflare/agents/api/observability.md): Emit and subscribe to observability events from Agents - [Counter Example](https://mintlify.wiki/cloudflare/agents/examples/counter.md): Build a simple counter agent with persistent state, callable methods, and real-time sync to a React frontend - [Chat Bot Example](https://mintlify.wiki/cloudflare/agents/examples/chat-bot.md): Build a simple AI chat bot with message history, streaming responses, and persistent state - [AI Chat Example](https://mintlify.wiki/cloudflare/agents/examples/ai-chat.md): Complete AI chat application with streaming responses, server-side and client-side tools, tool approval, and message pruning - [Dynamic Tools Example](https://mintlify.wiki/cloudflare/agents/examples/dynamic-tools.md): Build a chat agent where tools are defined dynamically by the client at runtime - the SDK/platform pattern - [Codemode Example](https://mintlify.wiki/cloudflare/agents/examples/codemode.md): Project management chat app where LLMs write and execute TypeScript code to orchestrate tools instead of calling them one at a time - [MCP Server Example](https://mintlify.wiki/cloudflare/agents/examples/mcp-server.md): Build a stateful MCP server using McpAgent backed by Durable Objects with persistent state, tools, and resources - [MCP Client Example](https://mintlify.wiki/cloudflare/agents/examples/mcp-client.md): Build an agent that connects to remote MCP servers, handles OAuth authentication, and aggregates tools, prompts, and resources - [x402 HTTP Payments Example](https://mintlify.wiki/cloudflare/agents/examples/x402-payments.md): HTTP payment gating using the x402 protocol with Hono middleware and automatic payment signing - [Email Agent Example](https://mintlify.wiki/cloudflare/agents/examples/email-agent.md): Build an email-processing agent with secure reply routing, auto-reply, loop prevention, and comprehensive security tests - [GitHub Webhook Example](https://mintlify.wiki/cloudflare/agents/examples/github-webhook.md): Real-time GitHub repository activity monitor with webhook handling, signature verification, and SQLite event storage - [Workflows Example](https://mintlify.wiki/cloudflare/agents/examples/workflows.md): Build multi-step workflows with human-in-the-loop approval, real-time progress tracking, and durable state management - [Tic Tac Toe Example](https://mintlify.wiki/cloudflare/agents/examples/tictactoe.md): Play Tic Tac Toe against an AI opponent powered by GPT-4o with persistent game state ## OpenAPI Specs - [openapi](https://mintlify.wiki/cloudflare/agents/api-reference/openapi.json)