building-ai-agent-on-cloudflare
Builds AI agents on Cloudflare using the Agents SDK with state management, real-time WebSockets, scheduled tasks, tool integration, and chat capabilities. Generates production-ready agent code deployed to Workers. Use when: user wants to "build an agent", "AI agent", "chat agent", "stateful agent", mentions "Agents SDK", needs "real-time AI", "WebSocket AI", or asks about agent "state management", "scheduled tasks", or "tool calling".
npx skills add majiayu000/claude-skill-registry --skill building-ai-agent-on-cloudflare --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Building Cloudflare Agents Creates AI-powered agents using Cloudflare's Agents SDK with persistent state, real-time communication, and tool integration. ## 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 ## Prerequisites - Cloudflare account with Workers enabled - Node.js 18+ and npm/pnpm/yarn - Wrangler CLI (`npm install -g wrangler`) ## Quick Start ```bash npm create cloudflare@latest -- my-agent --template=cloudflare/agents-starter cd my-agent npm start ``` Agent runs at `http://localhost:8787` ## Core Concepts ### What is an Agent? An Agent is a stateful, persistent AI service that: - Maintains state across requests and reconnections - Communicates via WebSockets or HTTP - Runs on Cloudflare's edge via Durable Objects - Can schedule tasks and call tools - Scales horizontally (each user/session gets own instance) ### Agent Lifecycle ``` Client connects → Agent.onConnect() → Agent processes messages → Agent.onMessage() → Agent.setState() (persists + syncs) Client disconnects → State
- When to Use
- Prerequisites
- Quick Start
- Core Concepts
- What is an Agent?
- Agent Lifecycle
- Basic Agent Structure
- Entry Point Configuration
- Wrangler Configuration
- State Management
- Reading State
- Updating State
- SQL Storage
- Scheduled Tasks
npm create cloudflare@latest -- my-agent --template=cloudflare/agents-starter cd my-agent npm start Deploy npx wrangler deploy View logs wrangler tail Test endpoint curl https://my-agent.workers.dev/agents/MyAgent/test-user
What does the building-ai-agent-on-cloudflare skill do?
Builds AI agents on Cloudflare using the Agents SDK with state management, real-time WebSockets, scheduled tasks, tool integration, and chat capabilities. Generates production-ready agent code deployed to Workers. Use when: user wants to "build an agent", "AI agent", "chat agent", "stateful agent", mentions "Agents SDK", needs "real-time AI", "WebSocket AI", or asks about agent "state management", "scheduled tasks", or "tool calling".
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill building-ai-agent-on-cloudflare --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
