Cloudflare Agents SDK
Build and deploy persistent, stateful AI agents on Cloudflare's global network using TypeScript — with built-in memory, scheduling, MCP support, durable workflows, and real-time WebSocket communication.
About Cloudflare Agents SDK
Cloudflare Agents SDK is an open source TypeScript framework for building and deploying persistent, stateful AI agents on Cloudflare's global edge network. Unlike traditional stateless AI applications that forget everything after each request, the Agents SDK gives developers a full execution environment where each agent maintains its own memory, schedule, tools, and real-time connections — all packaged as a TypeScript class.
Each agent runs on a Cloudflare Durable Object, a stateful micro-server with its own SQL database, WebSocket connections, and scheduling engine. Developers can deploy once and scale to tens of millions of agent instances across Cloudflare's global infrastructure. Agents hibernate when idle and consume no resources, then wake on demand — making them cost-efficient at any scale.
The SDK supports any AI model provider including Workers AI, OpenAI, Anthropic, and Google Gemini. With the v0.14.0 release (June 2026), the SDK added experimental Agent Skills for on-demand capability catalogs, chat messengers starting with Telegram, declarative scheduled tasks with timezone awareness, durable reasoning steps inside Workflows via ThinkWorkflow, and major production hardening for durable chat recovery across deploys and evictions.
The Cloudflare Agents SDK integrates tightly with the broader Cloudflare developer platform including Workers, AI Gateway, Vectorize (vector database), and Workflows — enabling developers to build complete AI-native applications without managing any external infrastructure.
Key Features
- Persistent Durable State: Every agent has a built-in SQL database and key-value state store that survives restarts, deploys, and hibernation, with real-time sync to all connected clients.
- AI Chat with Resumable Streams: The AIChatAgent class provides automatic message persistence, resumable streaming across disconnects, and server and client side tool execution with React hook integration.
- Model Context Protocol (MCP) Support: Agents can act as MCP servers or connect as MCP clients, exposing tools to other agents and LLMs with resumable SSE streams and readable server IDs.
- Agent Skills (Experimental): A catalog system that adds on-demand instructions, resources, and scripts to an agent's system prompt — so the model activates a skill only when a task matches, avoiding prompt bloat.
- Declarative Scheduled Tasks: Define recurring, timezone-aware prompts and handlers using a typed DSL; the SDK reconciles declarations on startup and re-arms after each run with durable idempotent submissions.
- Durable Workflows with Think Steps: ThinkWorkflow and step.prompt() enable model-driven reasoning inside Cloudflare Workflows, supporting long waits, typed structured output via Zod schemas, and human approval gates.
Pricing
Cloudflare Agents SDK is open source and free to use under the MIT license. Deployment costs are determined by Cloudflare Workers and Durable Objects usage, which follows Cloudflare's standard Workers pricing tiers:
-
Free (Workers Free Plan): $0/mo Includes 100,000 Worker requests per day and limited Durable Object compute; suitable for development and low-traffic agents.
-
Workers Paid Plan: $5/mo (plus usage) Includes 10 million requests per month, extended Durable Object compute and storage (charged per GB-second and per million requests), and access to production-grade features for deployed agents.
Full pricing details for Durable Objects, Workers AI, and Vectorize are available at cloudflare.com/plans.
Use Cases
- Building persistent AI chat assistants with durable message history and resumable streaming
- Deploying autonomous AI agents that act on schedules (daily digests, weekly reports, cron-based workflows)
- Creating per-user or per-session stateful agents that scale to millions of instances
- Connecting agents to external platforms via Telegram messengers or MCP servers
- Orchestrating multi-step human-in-the-loop approval workflows using ThinkWorkflow and Cloudflare Workflows
Pros & Cons
Pros:
- Agents are backed by Durable Objects, giving each instance isolated persistent state, SQL storage, and scheduling without external databases
- Open source MIT licensed with 4,500+ GitHub stars and active Cloudflare-maintained development
- Supports any AI model provider (Workers AI, OpenAI, Anthropic, Gemini) with no vendor lock-in
- Agents hibernate when idle, meaning millions of inactive agents cost nothing
- v0.14.0 production hardening ensures chat turns survive deploys, evictions, and stalled model streams reliably
Cons:
- Agent Skills and several advanced features are still experimental with APIs subject to change
- External pull requests are not currently accepted; community contribution is limited to issues and discussions
- Durable Objects pricing can become complex to predict at large scale with high-frequency state updates
Integrations
Cloudflare Workers, Cloudflare Durable Objects, Cloudflare Workflows, Cloudflare Workers AI, Cloudflare AI Gateway, Cloudflare Vectorize, Cloudflare Email Routing, Cloudflare R2, Telegram, OpenAI, Anthropic, Google Gemini, Hono (via hono-agents), React (useAgent / useAgentChat hooks), Model Context Protocol (MCP), Zod, Vite (Agents Vite plugin)
FAQ
Last edited
June 2, 2026 at 6:17 PM by Venkatraman Chandrasekaran
