Build AI agents that remember, reason, and act

The Agents SDK gives you the primitives to build proactive, stateful AI agents on Cloudflare. Built-in memory, scheduling, email handling, and real-time communication — agents that don't just respond, but take initiative.
Built-in memory

Every agent instance has its own SQLite database. Persist conversation history, user preferences, and state without managing infrastructure.

Proactive by design

Agents can schedule tasks, respond to emails, handle webhooks, and send messages — not just wait for user input.

Multiplayer by default

Built-in WebSocket support and state synchronization. Multiple users can interact with the same agent instance in real-time.

How Agents work

Stateful by default

Each agent instance is a Durable Object with its own SQLite database. State persists automatically across requests and hibernation cycles.

Real-time communication

WebSockets with automatic hibernation, resumable streams, and state sync. Build chat, collaboration, or multiplayer experiences.

Proactive scheduling

Schedule tasks with cron expressions, respond to incoming emails, or trigger actions from webhooks and queue messages.

MCP integration

Connect to any MCP server to give agents access to external tools, APIs, and data sources.

Observability

Logs, traces, and metrics out of the box. Route LLM calls through AI Gateway for caching, rate limiting, and cost tracking.

Agents for every use case

Build with the Agents SDK:

Background Pattern
Agents

You can use Agents to:

See real-world examples of Cloudflare Agents

View docs

Proactive assistants

Agents that send scheduled emails, monitor systems, and take action without waiting for user prompts.

Real-time collaboration

Multiplayer chat, collaborative editing, or shared agent sessions where multiple users interact simultaneously.

Messaging and notifications

Integrate with Slack, Discord, email, or any messaging platform. Agents can both receive and send messages proactively.

Workflow automation

Orchestrate multi-step tasks like data processing pipelines and order fulfillment flows. Durable Workflows handle retries and failures automatically.

From chat to code to orchestration

The Agents SDK handles state, streaming, and tool integration so you can focus on what your agent does.

Background Pattern
import { routeAgentRequest } from "agents";
import { AIChatAgent } from "@cloudflare/ai-chat";
import { streamText, convertToModelMessages } from "ai";
import { openai } from "@ai-sdk/openai";

export class ChatAgent extends AIChatAgent<Env> {
  async onChatMessage(onFinish) {
    const result = streamText({
      model: openai("gpt-5"),
      messages: await convertToModelMessages(this.messages),
      onFinish,
    });

    return result.toUIMessageStreamResponse();
  }
}

export default {
  async fetch(request: Request, env: Env) {
    return (await routeAgentRequest(request, env)) ||
      new Response("Not found", { status: 404 });
  },
};

Powerful primitives, seamlessly integrated

Built on systems powering 20% of the Internet, the Agents SDK builds on the same infrastructure Cloudflare uses to build Cloudflare. Enterprise-grade reliability, security, and performance are standard.

Build without boundaries

Join thousands of developers who've eliminated infrastructure complexity and deployed globally with Cloudflare. Start building for free — no credit card required.