Skip to content

Build Agents on Cloudflare

Last updated View as MarkdownAgent setup

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.

Channels
5
Agent
Agent harness

Controls planning, tool use, and response flow.

Agents SDK runtime

Durable identity, state, connections, scheduling, and recovery.

Agent class
Tools
5
ObservabilityLogs · metrics · traces

Agents on Cloudflare are composed from four parts:

Get started

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/chord

The 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:

Deploy to Cloudflare

Example agents

Pi agent

Build an agent on the Pi harness, with tools, sessions, and recovery after eviction.

Chat agent

Build a streaming AI chat agent with tools and human-in-the-loop approvals.

Slack agent

Build an agent that responds to Slack messages, mentions, and commands.

Voice agent

Build a real-time voice agent with speech-to-text and text-to-speech.

Browser agent

Build an agent that can inspect pages, capture screenshots, and use browser tools.

Email agent

Build an agent that sends, receives, routes, and replies to email.

Was this helpful?