# Cloudflare Agents SDK
[[Cloudflare]] Agents SDK is a TypeScript framework for building stateful AI agents on [[Cloudflare Workers]] and [[Cloudflare Durable Objects]]. Each agent instance maps to a single Durable Object — giving it strong consistency, persistent SQLite-backed state, WebSocket support, and the ability to schedule its own future work via alarms.
The SDK is Cloudflare-specific by design: it leans on Durable Objects' per-instance addressability, Workers' V8 isolate model, and the platform's WebSocket hibernation. It is not a generic agent framework like LangChain — it is "how to write durable agents that live forever on Cloudflare's edge."
## Why It Matters
Most agent frameworks treat state as an afterthought — assume external Redis, external DB, external queue. The Agents SDK inverts this: every agent has its own SQLite database inside its Durable Object, can wake up on a schedule, and resumes exactly where it left off after restarts. For long-running agents (research, monitoring, orchestration), this changes the operational model.
Pairs naturally with [[Cloudflare Workers AI]] for inference, [[Cloudflare Sandbox SDK]] for code execution, and [[Cloudflare Vectorize]] for memory/RAG.
## Core Primitives
- **Agent class**: extends Durable Object, exposes RPC methods, manages state
- **State management**: typed via TypeScript generics, persisted automatically
- **Scheduled tasks**: agents can call `this.schedule(when, method)` to invoke themselves later
- **Real-time**: WebSocket support for streaming responses to clients
- **Workflows**: durable, restartable multi-step processes
- **MCP servers**: ship agents as Model Context Protocol servers
## Common Use Cases
- **Chat agents** with persistent memory across sessions
- **Voice agents** with hibernating WebSocket connections
- **Browser-automation agents** orchestrating multi-step workflows
- **Background workers** that wake up, do work, sleep — for hours, days, weeks
- **MCP servers** exposing tools to Claude and other LLM clients
## References
- Agents SDK home: https://developers.cloudflare.com/agents/
- GitHub: https://github.com/cloudflare/agents
## Related
- [[Cloudflare]]
- [[Cloudflare Workers]]
- [[Cloudflare Durable Objects]]
- [[Cloudflare Workers AI]]
- [[Cloudflare Sandbox SDK]]
- [[Cloudflare Vectorize]]
- [[TypeScript]]
- [[Wrangler]]