Kipt

Cloudflare Agents SDK skill: build stateful agents with your coding agent

The Cloudflare Agents SDK skill gives your agent a docs map, core APIs and config gotchas for building agents with the agents package. Install and use it.

By the Kipt team · Updated 24 October 2026

Source: cloudflare/skills · Maintainer: Cloudflare · License: Apache-2.0 · Checked: 24 October 2026

What is the Cloudflare Agents SDK skill?

The Cloudflare Agents SDK skill is agents-sdk, an official Agent Skill that teaches your coding agent how to build stateful AI agents on Cloudflare with the agents npm package. It gives the agent a map of the current docs, the core APIs, the Wrangler setup and the gotchas that break builds.

Its SKILL.md description reads: "Build, debug, or review Cloudflare Agents SDK applications using the agents package."

Like the rest of the repo, it starts by distrusting the model's memory: "Your knowledge of the Agents SDK may be outdated. Prefer retrieval over pre-training for any Agents SDK task." As of 24 October 2026, the skills.sh page listed 104.8K installs (snapshot, 24 October 2026).

What does it do?

The skill loads when you work on an Agents SDK app. Its SKILL.md is built around five parts:

  • A retrieval table. Over 30 topics, almost all linked to a page in the Cloudflare Agents docs: quick start, configuration, state, routing, callable methods, scheduling, workflows, WebSockets, chat agents, the client SDK, email, MCP client and server, human-in-the-loop, durable execution, queues, retries, push notifications, webhooks, voice and more.
  • An install check. "FIRST: Verify Installation" with npm ls agents, then npm install agents if it's missing.
  • Wrangler configuration. A Durable Object binding and a new_sqlite_classes migration for each agent class, plus the nodejs_compat flag.
  • A sample Agent class with typed state, validateStateChange, onStateUpdate and a @callable() method, wired up with routeAgentRequest.
  • A core API table covering state, SQL, scheduling, RPC, workflows, fibers, queues, retries and broadcasting.

The capabilities it lists include SQLite-backed state synced to clients, @callable() RPC over WebSocket, one-time, recurring and cron scheduling, durable workflows, MCP integration, email handling, streaming chat with AIChatAgent, and React hooks (useAgent, useAgentChat). Voice, browser tools and Think are marked experimental.

The references/ folder has 19 files grouped as core, chat and streaming, background processing, integrations and experimental. Most are short and point the agent to the matching Cloudflare docs page. A few carry decisions of their own: client-sdk.md says to choose useAgent for React state and RPC, AgentClient for other WebSocket clients, and agentFetch for one-off HTTP; mcp.md says "For new servers, prefer createMcpHandler over the deprecated McpAgent."

How do you install it?

Just this skill, with the skills CLI. The command from skills.sh:

npx skills add https://github.com/cloudflare/skills --skill agents-sdk

Add -g to install for every project. The folder goes to .claude/skills/agents-sdk/ in your project, or ~/.claude/skills/agents-sdk/ globally, the Claude Code skill locations.

Claude Code plugin. The repo README gives:

/plugin marketplace add cloudflare/skills
/plugin install cloudflare@cloudflare

This installs every Cloudflare skill and Cloudflare's main remote MCP server.

Codex plugin.

codex plugin marketplace add cloudflare/skills
codex plugin add cloudflare@cloudflare

Other agents. The README covers Cursor (marketplace or a remote rule for cloudflare/skills), VS Code with GitHub Copilot (install from source), and a manual copy into each agent's skills folder. Codex and Cursor read the same SKILL.md format; see Codex skills and Cursor skills.

How do you use it?

Describe the agent you want and where it runs. Example prompts (suggestions, not quotes from the repo):

  • Create a Cloudflare agent that keeps a per-user todo list in state and exposes add and complete as callable methods.
  • Add a chat agent with AIChatAgent and a React page that uses useAgentChat.
  • Schedule this agent to check an RSS feed every 30 minutes and store new items in SQL.
  • Turn our existing Worker into a remote MCP server with createMcpHandler.
  • Our agent loses state after a deploy. Check the Wrangler migrations.

Requirements: Node.js, a Workers project with Wrangler, and the packages the skill asks for. Chat agents need agents, @cloudflare/ai-chat, ai and @ai-sdk/react. For Workers AI, the skill says to add "ai": { "binding": "AI" } to the config.

Agents are reached at /agents/{agent-name}/{instance-name}, so a Counter class with instance user-123 lives at /agents/counter/user-123. On the client, useAgent({ agent: "Counter", name: "user-123" }) connects to it. For custom routing, the skill shows getAgentByName(env.MyAgent, "instance-id") followed by agent.fetch(request).

Which Agents SDK APIs does the skill cover?

The SKILL.md has a quick reference table so the agent reaches for the right call. A selection, copied from it:

Task API in the skill
Read and write state this.state.count, this.setState({ count: 1 })
SQL query this.sql`SELECT * FROM users WHERE id = ${id}`
Run a task after a delay await this.schedule(60, "task", payload)
Cron schedule await this.schedule("0 * * * *", "task", payload)
Repeat on an interval await this.scheduleEvery(30, "poll")
RPC method @callable() myMethod() { ... }
Start a workflow await this.runWorkflow("ProcessingWorkflow", params)
Work that survives eviction await this.runFiber("name", async (ctx) => { ... })
Enqueue work this.queue("handler", payload)
Retry with backoff await this.retry(fn, { maxAttempts: 5 })
Send to all clients this.broadcast(message)

Because the skill tells the agent to confirm details against the current docs and your installed versions, treat the table as a starting point rather than a full API reference.

Tips and limits

The gotchas in the SKILL.md and its references are worth reading before you start:

  • "Do NOT enable experimentalDecorators in tsconfig (breaks @callable)."
  • Never edit old migrations; always add a new tag. Each agent class needs its own Durable Object binding and migration entry.
  • Check installed versions of agents, @cloudflare/ai-chat and the AI SDK before adapting docs examples. The skill links migration guides for AI SDK v5 and v6.
  • Think, voice, browser tools and Code Mode are grouped under Experimental; the Code Mode reference notes its "API may change."

Other notes:

  • Commands it runs. No scripts ship in the folder, but the skill tells the agent to run npm ls and npm install. Approve them as you would any install.
  • Audits. On 24 October 2026, skills.sh showed Pass from Gen Agent Trust Hub and Socket, and Warn from Snyk (audited 2 October 2026) for "Third-party content exposure detected (indirect prompt injection risk)," because agents it helps build can ingest email and webhooks. Treat inbound messages as untrusted in what you build.
  • License. Apache-2.0: you can copy and change it, keeping the license and notices.

Save it in your Kipt library

In Kipt, open Skills and paste the skill's GitHub folder link into the import box. Kipt brings in the SKILL.md and all 19 reference files; because cloudflare/skills holds many skills, it shows a list so you can add the Workers skill in the same step. Your library lives in a private GitHub repo you own and installs into Claude Code or Codex with one command:

npx skills add https://github.com/<you>/<repo>.git --all -g

Kipt is not affiliated with Cloudflare.

Similar skills

Questions

What is the Cloudflare Agents SDK skill?

It is agents-sdk, an official Agent Skill in the cloudflare/skills repo. It helps a coding agent build, debug or review apps that use Cloudflare's agents package, with a table of current docs pages, core APIs, Wrangler configuration and known gotchas. It is Apache-2.0 licensed.

How do I install the Agents SDK skill?

Run npx skills add https://github.com/cloudflare/skills --skill agents-sdk to install only this skill. In Claude Code you can also run /plugin marketplace add cloudflare/skills and then /plugin install cloudflare@cloudflare, which adds all Cloudflare skills and Cloudflare's MCP server.

Does the skill install the agents package for me?

It tells the agent to check first with npm ls agents and, if the package is missing, to run npm install agents. For chat agents it lists npm install agents @cloudflare/ai-chat ai @ai-sdk/react. The agent runs these in your project, so review them like any install.

Why did the skill get a Snyk warning?

On skills.sh, Snyk rated it Warn on 2 October 2026 for third-party content exposure, an indirect prompt injection risk, because agents built with it can handle incoming email and webhooks. Gen Agent Trust Hub and Socket rated it Pass.

Should I use McpAgent or createMcpHandler?

The skill's MCP reference says to prefer createMcpHandler for new servers over the deprecated McpAgent. For existing servers it says to check the installed SDK version and state needs before choosing a migration path.

More in Skill directory

All guides

Keep your prompts and skills in one place, in your own GitHub. Install every skill with one command.

Get started

Kipt is an independent product, not affiliated with or endorsed by Anthropic, OpenAI, Cursor or GitHub. Claude, ChatGPT, Codex, Cursor and GitHub are trademarks of their owners.