building-ai-agent-on-cloudflare

Installation
Summary

Stateful AI agents on Cloudflare Workers with WebSocket communication, persistent state, and scheduled tasks.

  • Build agents using the Agents SDK that maintain state across client reconnections and scale via Durable Objects
  • Support real-time WebSocket communication, HTTP endpoints, and automatic message history for chat-focused agents
  • Schedule background tasks with delay, specific dates, or cron expressions; query state with embedded SQLite
  • Extend Agent or AIChatAgent base classes, deploy with Wrangler, and integrate clients via React hooks or vanilla JavaScript
SKILL.md

Building Cloudflare Agents

Your knowledge of the Agents SDK may be outdated. Prefer retrieval over pre-training for any agent-building task.

Retrieval Sources

Source How to retrieve Use for
Agents SDK docs https://github.com/cloudflare/agents/tree/main/docs SDK API, state, routing, scheduling
Cloudflare Agents docs https://developers.cloudflare.com/agents/ Platform integration, deployment
Workers docs Search tool or https://developers.cloudflare.com/workers/ Runtime APIs, bindings, config

When to Use

  • User wants to build an AI agent or chatbot
  • User needs stateful, real-time AI interactions
  • User asks about the Cloudflare Agents SDK
  • User wants scheduled tasks or background AI work
  • User needs WebSocket-based AI communication
Related skills

More from cloudflare/skills

Installs
3.7K
GitHub Stars
1.5K
First Seen
Jan 19, 2026