Description
The Cloudflare Agents SDK is designed for developers looking to build and host stateful AI agents. These agents can maintain persistent memory, utilize real-time WebSocket connections, and execute scheduled tasks. With the SDK, developers can create agents that interact through various communication channels, including chat, voice, email, and Slack, ensuring a versatile approach to user engagement.
When deploying agents on Cloudflare, each session is assigned a durable identity, allowing for local SQL storage and recoverable execution. This infrastructure eliminates the need for managing complex backend systems, as Cloudflare handles the scaling and deployment across its global network. Developers can focus on building their agents without worrying about session reconstruction or state externalization.
The SDK comprises four main components: communication channels, the agent harness, the SDK runtime, and tools. Communication channels define how users and systems interact with the agents. The agent harness manages the operational loop, including model calls, tool selection, and response handling. The SDK runtime provides essential infrastructure, including the Agent class, state management, routing, and observability features. Finally, tools enhance agent capabilities, allowing for browser automation, sandboxed code execution, and AI search functionalities.
Developers can create various types of agents, such as a streaming AI chat agent with human-in-the-loop approvals, a Slack command responder, a real-time voice agent, or an email routing agent. The SDK also supports integration with multiple AI providers, enabling flexibility in model selection. Overall, the Cloudflare Agents SDK offers a robust framework for building intelligent, responsive agents that can operate efficiently in diverse environments.
Cloudflare Agents SDK's Core Features
Persistent memory
Real-time WebSocket connections
Scheduled tasks
Durable identity
Local SQL storage
Global network deployment
Multiple communication channels
Agent harness for operational control
Flexible tool integration
No API keys required
Getting Started with Cloudflare Agents SDK
Install via package manager: Download and install the Cloudflare Agents SDK.
Configure: Set up your agent's communication channels and tools.
Build: Develop your agent using the SDK runtime and agent harness.
Deploy: Launch your agent on Cloudflare's global network.
Optimise: Monitor performance and make adjustments as necessary.
Cloudflare Agents SDK's Use Cases
- Streaming AI Chat Agent
- Slack Command Responder
- Real-time Voice Agent
- Email Routing Agent
- Browser Automation Agent





