Build and host Agents on Cloudflare, connect chat, voice, email, Slack, and webhooks to a durable agent runtime with Browser, Sandbox, AI Search, MCP, Payments, and other MCP tools.
When you host agents on Cloudflare, each agent session has a durable identity, local SQL storage, real-time connections, scheduled work, and recoverable execution.
Deploy once and Cloudflare runs your agents across its global network, scaling to tens of millions of instances. No infrastructure to manage, no sessions to reconstruct, no state to externalize.
Controls planning, tool use, and response flow.
Durable identity, state, connections, scheduling, and recovery.
Agents on Cloudflare are composed from four parts:
- Communication channels define how users and systems reach your agent, such as chat, voice, email, Slack, webhooks, and other event sources.
- The agent harness defines the loop: how the agent calls models, selects tools, handles tool results, streams responses, and decides whether to continue. Use the Pi harness to run Pi Durable in a Durable Object, or build your own loop directly on the Agents SDK runtime.
- The Agents SDK runtime provides durable infrastructure: the
Agentclass, state, sessions, routing, WebSockets, scheduling, fibers, and observability. - Tools give the agent capabilities: browser automation, sandboxed code execution, AI Search, MCP tools, and payments. Code Mode lets models discover and orchestrate multiple tools by writing code.
Build your agent with the Pi harness. Pi Durable ↗︎ runs the agent loop, including the transcript, model calls, tools, and retries, inside a Durable Object. PiHarness from the Agents SDK stores Pi's state in the object's SQLite database and resumes the run after an eviction. No API keys are required. The examples use Workers AI through the AI binding.
npm i agents @earendil-works/pi-durable @earendil-works/pi-ai @earendil-works/chordyarn add agents @earendil-works/pi-durable @earendil-works/pi-ai @earendil-works/chordpnpm add agents @earendil-works/pi-durable @earendil-works/pi-ai @earendil-works/chordbun add agents @earendil-works/pi-durable @earendil-works/pi-ai @earendil-works/chordThe Pi harness guide builds a first agent in one file. To start from a complete app with a browser UI, a durable filesystem, and code execution, deploy the Pi harness example:
Build an agent on the Pi harness, with tools, sessions, and recovery after eviction.
Build a streaming AI chat agent with tools and human-in-the-loop approvals.
Build an agent that responds to Slack messages, mentions, and commands.
Build a real-time voice agent with speech-to-text and text-to-speech.
Build an agent that can inspect pages, capture screenshots, and use browser tools.
Build an agent that sends, receives, routes, and replies to email.