Agent toolingcloudflare
agents-sdk
Build AI agents on Cloudflare Workers using the Agents SDK. Load when creating stateful agents, durable workflows, real-time WebSocket apps, scheduled tasks, MCP servers, chat applications, voice agents, or browser automation. Covers Agent class, state management, callable RPC, Workflows, durable execution, queues, retries, observability, and React hooks. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
500 est. installs0 stars
Estimated installs are a discovery signal based on public repository popularity and source completeness, not recorded Dokki installation events.
Repository
cloudflare/skills
Pinned commit
f96bff754e42
License
Apache-2.0
Execution
Instructions only
Complete source instructions
SKILL.md
Cloudflare Agents SDK
Your knowledge of the Agents SDK may be outdated. Prefer retrieval over pre-training for any Agents SDK task.
Retrieval Sources
Cloudflare docs: https://developers.cloudflare.com/agents/
Capabilities
The Agents SDK provides:
- Persistent state — SQLite-backed, auto-synced to clients via
setState - Callable RPC —
@callable()methods invoked over WebSocket - Scheduling — One-time, recurring (
scheduleEvery), and cron tasks - Workflows — Durable multi-step background processing via
AgentWorkflow - Durable execution —
runFiber()/stash()for work that survives DO eviction - Queue — Built-in FIFO queue with retries via
queue() - Retries —
this.retry()with exponential backoff and jitter - MCP integration — Connect to MCP servers or build your own with
McpAgent - Email handling — Receive and reply to emails with secure routing
- Streaming chat —
AIChatAgentwith resumable streams, message persistence, tools - Server-driven messages —
saveMessages,waitUntilStablefor proactive agent turns - React hooks —
useAgent,useAgentChatfor client apps - Observability —
diagnostics_channelevents for state, RPC, schedule, lifecycle - Push notifications — Web Push + VAPID delivery from agents
- Webhooks — Receive and verify external webhooks
- Voice (experimental) — STT/TTS via
@cloudflare/voice - Browser tools (experimental) — CDP-powered browsing via
agents/browser - Think (experimental) — Higher-level chat agent via
@cloudflare/think
FIRST: Verify Installation
If not installed:
For chat agents:
Wrangler Configuration
Gotchas:
- Do NOT enable
experimentalDecoratorsin tsconfig (breaks@callable) - Never edit old migrations — always add new tags
- Each agent class needs its own DO binding + migration entry
- Add
"ai": { "binding": "AI" }for Workers AI
Agent Class
Routing
Requests route to /agents/{agent-name}/{instance-name}:
Client: useAgent({ agent: "Counter", name: "user-123" })
Custom routing: use getAgentByName(env.MyAgent, "instance-id") then agent.fetch(request).
Core APIs
React Client
References
Core
- references/state-scheduling.md [blocked] — State persistence, scheduling, SQL
- references/callable.md [blocked] — RPC methods, streaming, timeouts
- references/routing.md [blocked] — URL patterns, custom routing,
getAgentByName - references/configuration.md [blocked] — Wrangler config, bindings, Vite setup
Chat & Streaming
- references/streaming-chat.md [blocked] — AIChatAgent, resumable streams, tools
- references/client-sdk.md [blocked] —
useAgent,useAgentChat,AgentClient - references/server-driven-messages.md [blocked] — Trigger patterns,
saveMessages - references/human-in-the-loop.md [blocked] — Approval flows,
needsApproval
Background Processing
- references/workflows.md [blocked] — Durable Workflows integration
- references/durable-execution.md [blocked] —
runFiber,stash, surviving eviction - references/queue-retries.md [blocked] — Built-in queue, retry with backoff
Integrations
- references/mcp.md [blocked] — MCP client and server, transports, securing
- references/email.md [blocked] — Email routing and handling
- references/webhooks-push.md [blocked] — Webhooks, push notifications
- references/observability.md [blocked] — Diagnostics-channel events
Experimental
- references/think.md [blocked] —
@cloudflare/thinkhigher-level chat agent - references/voice.md [blocked] —
@cloudflare/voiceSTT/TTS - references/codemode.md [blocked] — Code Mode for tool orchestration
- references/browse-the-web.md [blocked] — CDP browser tools
Same repository
Related Skills
cloudflare
Comprehensive Cloudflare platform skill covering Workers, Pages, storage (KV, D1, R2), AI (Workers AI, Vectorize, Agents SDK), feature flags (Flagship), networking (Tunnel, Spectrum), security (WAF, DDoS), and infrastructure-as-code (Terraform, Pulumi). Use for any Cloudflare development task. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
View detailscloudflare-email-service
Send and receive transactional emails with Cloudflare Email Service (Email Sending + Email Routing). Use when building email sending (Workers binding or REST API), email routing, Agents SDK email handling, or integrating email into any app — Workers, Node.js, Python, Go, etc. Also use for email deliverability, SPF/DKIM/DMARC, wrangler email setup, MCP email tools, or when a coding agent needs to send emails. Even for simple requests like "add email to my Worker" — this skill has critical config details.
View detailscloudflare-one
Guides Cloudflare One Zero Trust and SASE work across Access, Gateway, WARP, Tunnel, Cloudflare WAN, DLP, CASB, device posture, and identity. Use when designing, configuring, troubleshooting, or reviewing Cloudflare One deployments. Retrieval-first: use current Cloudflare docs/API schemas instead of embedded product docs.
View detailscloudflare-one-migrations
Plans migrations from Zscaler ZIA/ZPA, Palo Alto, legacy VPN, SWG, or SASE stacks to Cloudflare One. Use for migration assessments, policy mapping, rollout plans, and parity/gap analysis.
View detailsdurable-objects
Create and review Cloudflare Durable Objects. Use when building stateful coordination (chat rooms, multiplayer games, booking systems), implementing RPC methods, SQLite storage, alarms, WebSockets, or reviewing DO code for best practices. Covers Workers integration, wrangler config, and testing with Vitest. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
View detailssandbox-migrate-to-next
Use when porting a Cloudflare Sandbox app from stable @cloudflare/sandbox to @cloudflare/sandbox@next (Sandbox SDK 1.0 preview), or when the user asks to migrate or upgrade to Sandbox 1.0 / @next. Not for day-to-day stable work (sandbox-stable) or new @next apps (sandbox-next).
View details