Build stateful AI agents that hibernate between calls
It turns Cloudflare Durable Objects into persistent, callable agent instances that cost nothing when idle.

What it does
cloudflare/agents is a TypeScript framework for deploying persistent, stateful AI workloads on Cloudflare Workers. Each agent lives inside its own Durable Object with SQLite storage and a lifecycle, letting you run millions of isolated instances that wake on demand and sleep while idle.
The interesting bit
Instead of treating AI agents as ephemeral serverless functions, the SDK gives each one a long-running identity at the edge. It bundles a broad stack into the same runtime: real-time sync, scheduling, MCP plumbing, voice pipelines, sandboxed code execution, and even pay-per-call APIs via the x402 protocol.
Key highlights
- Core
Agentclass handles state persistence,@callable()RPC, WebSockets, and scheduling out of the box. - Specialized packages add voice pipelines (
@cloudflare/voice), LLM-generated code execution (@cloudflare/codemode), and sandboxed Workers (@cloudflare/shell). - Supports the Model Context Protocol as both client and server, plus WebMCP to tunnel browser-side tools over WebSocket.
- Includes React hooks (
useAgent,useAgentChat,useVoiceAgent) and a vanillaAgentClientfor frontend sync. - Over 30 self-contained examples, from chat and workflows to tic-tac-toe and email agents.
Caveats
- The
experimental/directory contains work-in-progress features with explicit “no stability guarantees.” - Several older AI-chat entry points are deprecated and still exist only as re-exports, so check import paths against the current package list.
Verdict
Worth exploring if you already run on Cloudflare and need persistent, stateful agent instances rather than stateless inference wrappers. Skip it if you are not prepared to adopt the Durable Object and Workers ecosystem lock-in.
Frequently asked
- What is cloudflare/agents?
- It turns Cloudflare Durable Objects into persistent, callable agent instances that cost nothing when idle.
- Is agents open source?
- Yes — cloudflare/agents is open source, released under the MIT license.
- What language is agents written in?
- cloudflare/agents is primarily written in TypeScript.
- How popular is agents?
- cloudflare/agents has 5.3k stars on GitHub.
- Where can I find agents?
- cloudflare/agents is on GitHub at https://github.com/cloudflare/agents.