Build Agents on Cloudflare (9)

Last updated Oct 22, 2026 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.

Chat Email Voice Slack Webhook

Agent harness

Controls planning, tool use, and response flow.

Pi harness Build-your-own agent

Agents SDK runtime

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

Agent class

State Sessions Routing WebSockets Scheduling Fibers

Sandbox MCP Browser AI Search Payments

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.

npmyarnpnpmbun

npm i agents @earendil-works/pi-durable @earendil-works/pi-ai @earendil-works/chord
yarn add agents @earendil-works/pi-durable @earendil-works/pi-ai @earendil-works/chord
pnpm add agents @earendil-works/pi-durable @earendil-works/pi-ai @earendil-works/chord
bun add 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?

YesNo

On this page

Build Agents on Cloudflare (9) - 图2Docs

{"@context":"https://schema.org","@type":"WebPage","@id":"https://developers.cloudflare.com/agents/#page","headline":"Build Agents on Cloudflare","description":"Build and host AI agents on Cloudflare. Start with the Pi harness, which runs a durable model loop with tools in a Durable Object, and add state, real-time connections, and scheduled tasks with the Agents SDK.","url":"https://developers.cloudflare.com/agents/","inLanguage":"en","image":"https://developers.cloudflare.com/agents/og.png?v=5f3790c1b824e669","dateModified":"2026-10-22","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"},"keywords":["AI"]}


description: Send invoice when shopping cart is checked out and paid for title: Export and save D1 database image: https://developers.cloudflare.com/workflows/examples/backup-d1/og.png?v=f4273a2d7572c577


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/workflows/llms.txt
Use this file to discover all available pages before exploring further.