.fyi
SkillsMCPPluginsSubagents

Browse by category

DevOps & CI/CD SkillsProductivity & Workflow SkillsOther SkillsProduct & Project Management SkillsDocumentation & Knowledge SkillsCode Review & Refactor SkillsBackend & APIs SkillsAgent Meta & Communication SkillsResearch SkillsSecurity SkillsUX UI & Design SkillsTesting & QA SkillsSee all →

Every Claude Code skill, MCP server, plugin and subagent in one directory. Searchable, comparable, and one command from installed. Live stats from GitHub, npm and PyPI.

We're on Product HuntYour agent's app storeCheck it out →
Agent SkillsMCP ServersPluginsSubagentsCoding Agents
CollectionsOfficial publishersGlossaryFAQBlogSearchSavedFeedback
PrivacyTermsllms.txtSitemap

made with ♥ · © 2026 aaaa.fyi

Independent project · real data from public registries

…/skills/agents-sdk
home/skills/cloudflare/skills/agents-sdk
cloudflare avatar

agents-sdk

bycloudflare· 64 skills

Installs

28k

Stars

2.5k

Forks

232

Category

AI Agents & MCP

View on GitHub

TL;DR

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.

How to install agents-sdk?

cloudflare/skills/agents-sdk
$npx -y skills add cloudflare/skills --skill agents-sdk

Installs into the current project.

›Prefer a prompt? Paste this to your agent

Use this skill

Run `npx skills use "https://github.com/cloudflare/skills" --skill "cloudflare/skills/agents-sdk"` and follow the generated skill instructions now. Read its complete output, redirecting it to a temporary file first if necessary. Resolve relative paths from the supporting-files directory it provides.

Use the whole pack

Use the skills in "https://github.com/cloudflare/skills" that are relevant to the current task. Run `npx skills add "https://github.com/cloudflare/skills"` and select the relevant skills, then follow their instructions.

Files · 1

View on GitHub
SKILL.md
1# Cloudflare Agents SDK
2 
3Your knowledge of the Agents SDK may be outdated. **Prefer retrieval over pre-training** for any Agents SDK task.
4 
5## Retrieval Sources
6 
7Cloudflare docs: https://developers.cloudflare.com/agents/
8 
9| Topic | Docs URL | Use for |
10|-------|----------|---------|
11| Getting started | [Quick start](https://developers.cloudflare.com/agents/getting-started/quick-start/) | First agent, project setup |
12| Adding to existing project | [Add to existing project](https://developers.cloudflare.com/agents/getting-started/add-to-existing-project/) | Install into existing Workers app |
13| Configuration | [Configuration](https://developers.cloudflare.com/agents/api-reference/configuration/) | `wrangler.jsonc`, bindings, assets, deployment |
14| Agent class | [Agents API](https://developers.cloudflare.com/agents/api-reference/agents-api/) | Agent lifecycle, patterns, pitfalls |
15| State | [Store and sync state](https://developers.cloudflare.com/agents/api-reference/store-and-sync-state/) | `setState`, `validateStateChange`, persistence |
16| Routing | [Routing](https://developers.cloudflare.com/agents/api-reference/routing/) | URL patterns, `routeAgentRequest` |
17| Callable methods | [Callable methods](https://developers.cloudflare.com/agents/api-reference/callable-methods/) | `@callable`, RPC, streaming, timeouts |
18| Scheduling | [Schedule tasks](https://developers.cloudflare.com/agents/api-reference/schedule-tasks/) | `schedule()`, `scheduleEvery()`, cron |
19| Workflows | [Run workflows](https://developers.cloudflare.com/agents/api-reference/run-workflows/) | `AgentWorkflow`, durable multi-step tasks |
20| HTTP/WebSockets | [WebSockets](https://developers.cloudflare.com/agents/api-reference/websockets/) | Lifecycle hooks, hibernation |
21| Chat agents | [Chat agents](https://developers.cloudflare.com/agents/api-reference/chat-agents/) | `AIChatAgent`, streaming, tools, persistence |
22| Client SDK | [Client SDK](https://developers.cloudflare.com/agents/api-reference/client-sdk/) | `useAgent`, `useAgentChat`, React hooks |
23| Client tools | [Client tools](https://developers.cloudflare.com/agents/api-reference/client-tools/) | Client-side tools, `autoContinueAfterToolResult` |
24| Server-driven messages | [Trigger patterns](https://developers.cloudflare.com/agents/api-reference/trigger-patterns/) | `saveMessages`, `waitUntilStable`, server-initiated turns |
25| Resumable streaming | [Resumable streaming](https://developers.cloudflare.com/agents/api-reference/resumable-streaming/) | Stream recovery on disconnect |
26| Email | [Email](https://developers.cloudflare.com/agents/api-reference/email/) | Email routing, secure reply resolver |
27| MCP client | [MCP client](https://developers.cloudflare.com/agents/api-reference/mcp-client-api/) | Connecting to MCP servers |
28| MCP server | [MCP server](https://developers.cloudflare.com/agents/api-reference/mcp-agent-api/) | Building MCP servers with `McpAgent` |
29| MCP transports | [MCP transports](https://developers.cloudflare.com/agents/api-reference/mcp-transports/) | Streamable HTTP, SSE, RPC transport options |
30| Securing MCP servers | [Securing MCP](https://developers.cloudflare.com/agents/api-reference/securing-mcp-servers/) | OAuth, proxy MCP, hardening |
31| Human-in-the-loop | [Human-in-the-loop](https://developers.cloudflare.com/agents/concepts/human-in-the-loop/) | Approval flows, `needsApproval`, workflows |
32| Durable execution | [Durable execution](https://developers.cloudflare.com/agents/api-reference/durable-execution/) | `runFiber()`, `stash()`, surviving DO eviction |
33| Queue | [Queue](https://developers.cloudflare.com/agents/api-reference/queue-tasks/) | Built-in FIFO queue, `queue()` |
34| Retries | [Retries](https://developers.cloudflare.com/agents/api-reference/retries/) | `this.retry()`, backoff/jitter |
35| Observability | [Observability](https://developers.cloudflare.com/agents/api-reference/observability/) | Diagnostics-channel events |
36| Push notifications | [Push notifications](https://developers.cloudflare.com/agents/api-reference/push-notifications/) | Web Push + VAPID from agents |
37| Webhooks | [Webhooks](https://developers.cloudflare.com/agents/api-reference/webhooks/) | Receiving external webhooks |
38| Cross-domain auth | [Cross-domain auth](https://developers.cloudflare.com/agents/api-reference/cross-domain-authentication/) | WebSocket auth, tokens, CORS |
39| Readonly connections | [Readonly](https://developers.cloudflare.com/agents/api-reference/readonly-connections/) | `shouldConnectionBeReadonly` |
40| Voice | [Voice](https://developers.cloudflare.com/agents/api-reference/voice/) | Experimental STT/TTS, `withVoice` |
41| Browse the web | [Browser tools](https://developers.cloudflare.com/agents/api-reference/browse-the-web/) | Experimental CDP browser automation |
42| Think | [Think](https://developers.cloudflare.com/agents/api-reference/think/) | Experimental higher-level chat agent class |
43| Migrations | [AI SDK v5](https://developers.cloudflare.com/agents/guides/migration-to-ai-sdk-v5/), [AI SDK v6](https://developers.cloudflare.com/agents/guides/migration-to-ai-sdk-v6/) | Upgrading `@cloudflare/ai-chat` |
44 
45## Capabilities
46 
47The Agents SDK provides:
48 
49- **Persistent state** — SQLite-backed, auto-synced to clients via `setState`
50- **Callable RPC** — `@callable()` methods invoked over WebSocket
51- **Scheduling** — One-time, recurring (`scheduleEvery`), and cron tasks
52- **Workflows** — Durable multi-step background processing via `AgentWorkflow`
53- **Durable execution** — `runFiber()` / `stash()` for work that survives DO eviction
54- **Queue** — Built-in FIFO queue with retries via `queue()`
55- **Retries** — `this.retry()` with exponential backoff and jitter
56- **MCP integration** — Connect to MCP servers or build your own with `McpAgent`
57- **Email handling** — Receive and reply to emails with secure routing
58- **Streaming chat** — `AIChatAgent` with resumable streams, message persistence, tools
59- **Server-driven messages** — `saveMessages`, `waitUntilStable` for proactive agent turns
60- **React hooks** — `useAgent`, `useAgentChat` for client apps
61- **Observability** — `diagnostics_channel` events for state, RPC, schedule, lifecycle
62- **Push notifications** — Web Push + VAPID delivery from agents
63- **Webhooks** — Receive and verify external webhooks
64- **Voice** (experimental) — STT/TTS via `@cloudflare/voice`
65- **Browser tools** (experimental) — CDP-powered browsing via `agents/browser`
66- **Think** (experimental) — Higher-level chat agent via `@cloudflare/think`
67 
68## FIRST: Verify Installation
69 
70```bash
71npm ls agents # Should show agents package
72```
73 
74If not installed:
75```bash
76npm install agents
77```
78 
79For chat agents:
80```bash
81npm install agents @cloudflare/ai-chat ai @ai-sdk/react
82```
83 
84## Wrangler Configuration
85 
86```jsonc
87{
88 "compatibility_flags": ["nodejs_compat"],
89 "durable_objects": {
90 "bindings": [{ "name": "MyAgent", "class_name": "MyAgent" }]
91 },
92 "migrations": [{ "tag": "v1", "new_sqlite_classes": ["MyAgent"] }]
93}
94```
95 
96**Gotchas:**
97- Do NOT enable `experimentalDecorators` in tsconfig (breaks `@callable`)
98- Never edit old migrations — always add new tags
99- Each agent class needs its own DO binding + migration entry
100- Add `"ai": { "binding": "AI" }` for Workers AI
101 
102## Agent Class
103 
104```typescript
105import { Agent, routeAgentRequest, callable } from "agents";
106 
107type State = { count: number };
108 
109export class Counter extends Agent<Env, State> {
110 initialState = { count: 0 };
111 
112 validateStateChange(nextState: State, source: Connection | "server") {
113 if (nextState.count < 0) throw new Error("Count cannot be negative");
114 }
115 
116 onStateUpdate(state: State, source: Connection | "server") {
117 console.log("State updated:", state);
118 }
119 
120 @callable()
121 increment() {
122 this.setState({ count: this.state.count + 1 });
123 return this.state.count;
124 }
125}
126 
127export default {
128 fetch: (req, env) => routeAgentRequest(req, env) ?? new Response("Not found", { status: 404 })
129};
130```
131 
132## Routing
133 
134Requests route to `/agents/{agent-name}/{instance-name}`:
135 
136| Class | URL |
137|-------|-----|
138| `Counter` | `/agents/counter/user-123` |
139| `ChatRoom` | `/agents/chat-room/lobby` |
140 
141Client: `useAgent({ agent: "Counter", name: "user-123" })`
142 
143Custom routing: use `getAgentByName(env.MyAgent, "instance-id")` then `agent.fetch(request)`.
144 
145## Core APIs
146 
147| Task | API |
148|------|-----|
149| Read state | `this.state.count` |
150| Write state | `this.setState({ count: 1 })` |
151| SQL query | `` this.sql`SELECT * FROM users WHERE id = ${id}` `` |
152| Schedule (delay) | `await this.schedule(60, "task", payload)` |
153| Schedule (cron) | `await this.schedule("0 * * * *", "task", payload)` |
154| Schedule (interval) | `await this.scheduleEvery(30, "poll")` |
155| RPC method | `@callable() myMethod() { ... }` |
156| Streaming RPC | `@callable({ streaming: true }) stream(res) { ... }` |
157| Start workflow | `await this.runWorkflow("ProcessingWorkflow", params)` |
158| Durable fiber | `await this.runFiber("name", async (ctx) => { ... })` |
159| Enqueue work | `this.queue("handler", payload)` |
160| Retry with backoff | `await this.retry(fn, { maxAttempts: 5 })` |
161| Broadcast to clients | `this.broadcast(message)` |
162| Get connections | `this.getConnections(tag?)` |
163 
164## React Client
165 
166```tsx
167import { useAgent } from "agents/react";
168 
169function App() {
170 const [state, setLocalState] = useState({ count: 0 });
171 
172 const agent = useAgent({
173 agent: "Counter",
174 name: "my-instance",
175 onStateUpdate: (newState) => setLocalState(newState),
176 onIdentity: (name, agentType) => console.log(`Connected to ${name}`)
177 });
178 
179 return (
180 <button onClick={() => agent.setState({ count: state.count + 1 })}>
181 Count: {state.count}
182 </button>
183 );
184}
185```
186 
187## References
188 
189### Core
190- **[references/state-scheduling.md](references/state-scheduling.md)** — State persistence, scheduling, SQL
191- **[references/callable.md](references/callable.md)** — RPC methods, streaming, timeouts
192- **[references/routing.md](references/routing.md)** — URL patterns, custom routing, `getAgentByName`
193- **[references/configuration.md](references/configuration.md)** — Wrangler config, bindings, Vite setup
194 
195### Chat & Streaming
196- **[references/streaming-chat.md](references/streaming-chat.md)** — AIChatAgent, resumable streams, tools
197- **[references/client-sdk.md](references/client-sdk.md)** — `useAgent`, `useAgentChat`, `AgentClient`
198- **[references/server-driven-messages.md](references/server-driven-messages.md)** — Trigger patterns, `saveMessages`
199- **[references/human-in-the-loop.md](references/human-in-the-loop.md)** — Approval flows, `needsApproval`
200 
201### Background Processing
202- **[references/workflows.md](references/workflows.md)** — Durable Workflows integration
203- **[references/durable-execution.md](references/durable-execution.md)** — `runFiber`, `stash`, surviving eviction
204- **[references/queue-retries.md](references/queue-retries.md)** — Built-in queue, retry with backoff
205 
206### Integrations
207- **[references/mcp.md](references/mcp.md)** — MCP client and server, transports, securing
208- **[references/email.md](references/email.md)** — Email routing and handling
209- **[references/webhooks-push.md](references/webhooks-push.md)** — Webhooks, push notifications
210- **[references/observability.md](references/observability.md)** — Diagnostics-channel events
211 
212### Experimental
213- **[references/think.md](references/think.md)** — `@cloudflare/think` higher-level chat agent
214- **[references/voice.md](references/voice.md)** — `@cloudflare/voice` STT/TTS
215- **[references/codemode.md](references/codemode.md)** — Code Mode for tool orchestration
216- **[references/browse-the-web.md](references/browse-the-web.md)** — CDP browser tools

Security

Review

  • Gen Agent Trust Hubpass
  • Socketpass
  • Snykwarn
  • Runlayerpass
  • ZeroLeakspass

Preview

cloudflare/skillscloudflare/skills

$ npx -y skills add cloudflare/skills --skill agents-sdk

▸ installing to .claude/skills…

✓ agents-sdk ready

Repocloudflare/skills
TypeSkills
CategoryAI Agents & MCP
ForDeveloper
UpdatedJul 2026
License—
First seenJul 26, 2026

Tags

Skill

Related

6 picks
Type
  1. vercel-labs avatarfind-skillsHelps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express…SkillsJul 20262.7M27k
  2. anthropics avatarmcp-builderGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools.SkillsJul 202695k164k
  3. google avatargoogle-agents-cli-adk-codeThis skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use…SkillsJul 202666k5.4k
  4. google avatargoogle-agents-cli-workflowThis skill should be used when the user wants to "develop an agent", "build an agent using ADK", "run the agent locally", "debug agent code", "test an agent",…SkillsJul 202665k5.4k
  5. google avatargoogle-agents-cli-evalThis skill should be used when the user wants to "run an evaluation", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval…SkillsJul 202665k5.4k
  6. google avatargoogle-agents-cli-scaffoldThis skill should be used when the user wants to "create an agent project", "start a new ADK project", "build me a new agent", "add CI/CD to my project", "add…SkillsJul 202665k5.4k