Official agent skill

Agents SDK

by cloudflare in cloudflare/skills

Build, debug, or review Cloudflare Agents SDK applications using the agents package.

OfficialApache-2.0Auto-check passedAgent Workflows

Install Agents SDK

skills CLI
$ npx skills add cloudflare/skills --skill agents-sdk -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install cloudflare/skills agents-sdk --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/cloudflare/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/agents-sdk .claude/skills/agents-sdk && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
agents-sdk
GitHub stars
3k
Used in
2 other repos
Token cost
~3k tokens
SKILL.md length
685 words
Files
20 (incl. references)
Skills in repo
16
Repo updated
First seen
Licence
Apache-2.0

At a glance

Build, debug, or review Cloudflare Agents SDK applications using the agents package.

  • Tasks that involve MCP servers
  • SKILL.md covers Retrieval Sources, Capabilities, FIRST: Verify Installation and Wrangler Configuration, plus 5 more sections
  • Calls npm

What it does

Agents SDK is an agent skill from cloudflare/skills, published by the product's own GitHub organization. Build, debug, or review Cloudflare Agents SDK applications using the agents package.

Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 20 other files, including reference files (for example `references/browse-the-web.md`, `references/callable.md` and `references/client-sdk.md`).

It sits in Agent Workflows, covering MCP servers. It works with Cloudflare, Cloudflare Workers and Model Context Protocol. The repository describes itself as: Skills for teaching agents how to build on Cloudflare. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve MCP servers

Example prompts

  • “/agents-sdk”

Requirements

  • Node.js

What it can do on your machine

Read from SKILL.md and the folder at commit 41e0d19. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • developers.cloudflare.com
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Agents SDK loads about 3k tokens when it runs, and up to ~12k if it reads all its reference files. Until then it costs about 24 tokens; SKILL.md has 685 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~24
When it runs · the whole SKILL.md, loaded when a task matches
~3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~12k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from cloudflare/skills at commit 41e0d19, republished under its Apache-2.0 licence (© cloudflare). 685 words, ~3,003 tokens.

Download SKILL.mdSave it as .claude/skills/agents-sdk/SKILL.md (or your agent's skills folder). This skill also uses 19 other files; get the full folder from GitHub.
name
agents-sdk
description
Build, debug, or review Cloudflare Agents SDK applications using the agents package.

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/index.md

TopicDocs URLUse for
Getting startedQuick startFirst agent, project setup
Adding to existing projectAdd to existing projectInstall into existing Workers app
ConfigurationConfigurationwrangler.jsonc, bindings, assets, deployment
Agent classAgents APIAgent lifecycle, patterns, pitfalls
StateStore and sync statesetState, validateStateChange, persistence
RoutingRoutingURL patterns, routeAgentRequest
Callable methodsCallable methods@callable, RPC, streaming, timeouts
SchedulingSchedule tasksschedule(), scheduleEvery(), cron
WorkflowsRun workflowsAgentWorkflow, durable multi-step tasks
HTTP/WebSocketsWebSocketsLifecycle hooks, hibernation
Chat agentsChat agentsAIChatAgent, streaming, tools, persistence
Client SDKClient SDKuseAgent, AgentClient, state, RPC, HTTP
Client toolsClient toolsClient-side tools, autoContinueAfterToolResult
Server-driven messagesAutonomous responsessaveMessages, waitUntilStable, server-initiated turns
Resumable streamingChat agentsStream recovery on disconnect
EmailEmailEmail routing, secure reply resolver
MCP clientMCP clientConnecting to MCP servers
MCP serverMCP serverBuilding MCP servers with createMcpHandler
MCP transportsMCP transportsStreamable HTTP, SSE, RPC transport options
Securing MCP serversSecuring MCPOAuth, proxy MCP, hardening
Human-in-the-loopHuman-in-the-loopWorkflow approvals, elicitation, timeout handling
Durable executionDurable executionrunFiber(), stash(), surviving DO eviction
QueueQueueBuilt-in FIFO queue, queue()
RetriesRetriesthis.retry(), backoff/jitter
ObservabilityObservabilityDiagnostics-channel events
Push notificationsPush notificationsWeb Push + VAPID from agents
WebhooksWebhooksReceiving external webhooks
Cross-domain authCross-domain authWebSocket auth, tokens, CORS
Readonly connectionsReadonlyshouldConnectionBeReadonly
VoiceVoiceExperimental STT/TTS, withVoice
Browse the webBrowser toolsExperimental CDP browser automation
ThinkThinkExperimental higher-level chat agent class
MigrationsAI SDK v5, AI SDK v6Upgrading @cloudflare/ai-chat

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 createMcpHandler
  • Email handling — Receive and reply to emails with secure routing
  • Streaming chat — AIChatAgent with resumable streams, message persistence, tools
  • Server-driven messages — saveMessages, waitUntilStable for proactive agent turns
  • React hooks — useAgent, useAgentChat for client apps
  • Observability — diagnostics_channel events 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
Show full SKILL.md (265 more words)Show less

FIRST: Verify Installation

bash
npm ls agents  # Should show agents package

If not installed:

bash
npm install agents

For chat agents:

bash
npm install agents @cloudflare/ai-chat ai @ai-sdk/react

Wrangler Configuration

jsonc
{
  "compatibility_flags": ["nodejs_compat"],
  "durable_objects": {
    "bindings": [{ "name": "MyAgent", "class_name": "MyAgent" }]
  },
  "migrations": [{ "tag": "v1", "new_sqlite_classes": ["MyAgent"] }]
}

Gotchas:

  • Do NOT enable experimentalDecorators in 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

typescript
import { Agent, routeAgentRequest, callable } from "agents";

type State = { count: number };

export class Counter extends Agent<Env, State> {
  initialState = { count: 0 };

  validateStateChange(nextState: State, source: Connection | "server") {
    if (nextState.count < 0) throw new Error("Count cannot be negative");
  }

  onStateUpdate(state: State, source: Connection | "server") {
    console.log("State updated:", state);
  }

  @callable()
  increment() {
    this.setState({ count: this.state.count + 1 });
    return this.state.count;
  }
}

export default {
  fetch: (req, env) => routeAgentRequest(req, env) ?? new Response("Not found", { status: 404 })
};

Routing

Requests route to /agents/{agent-name}/{instance-name}:

ClassURL
Counter/agents/counter/user-123
ChatRoom/agents/chat-room/lobby

Client: useAgent({ agent: "Counter", name: "user-123" })

Custom routing: use getAgentByName(env.MyAgent, "instance-id") then agent.fetch(request).

Core APIs

TaskAPI
Read statethis.state.count
Write statethis.setState({ count: 1 })
SQL querythis.sql`SELECT * FROM users WHERE id = ${id}`
Schedule (delay)await this.schedule(60, "task", payload)
Schedule (cron)await this.schedule("0 * * * *", "task", payload)
Schedule (interval)await this.scheduleEvery(30, "poll")
RPC method@callable() myMethod() { ... }
Streaming RPC@callable({ streaming: true }) stream(res) { ... }
Start workflowawait this.runWorkflow("ProcessingWorkflow", params)
Durable fiberawait this.runFiber("name", async (ctx) => { ... })
Enqueue workthis.queue("handler", payload)
Retry with backoffawait this.retry(fn, { maxAttempts: 5 })
Broadcast to clientsthis.broadcast(message)
Get connectionsthis.getConnections(tag?)

React Client

Read client-sdk.md for client selection and current connection examples. For chat UI and tools, also read streaming-chat.md.

References

Core
Chat & Streaming
Background Processing
Integrations
Experimental

© cloudflare, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 19 other files (references) in skills/agents-sdk of cloudflare/skills.

  • SKILL.md
  • references/browse-the-web.md
  • references/callable.md
  • references/client-sdk.md
  • references/codemode.md
  • references/configuration.md
  • references/durable-execution.md
  • references/email.md
  • references/human-in-the-loop.md
  • references/mcp.md
  • references/observability.md
  • references/queue-retries.md
  • references/routing.md
  • references/server-driven-messages.md
  • references/state-scheduling.md
  • references/streaming-chat.md
  • references/think.md
  • references/voice.md
  • references/webhooks-push.md
  • references/workflows.md

Open the folder on GitHubat commit 41e0d19

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in cloudflare/skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Agents SDK next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Agents SDK compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Agents SDK this skillcloudflare/skills3k2 repos~3kAutomated safety check: PassApache-2.0
Building MCP Server On CloudflareCommandCodeAI/agent-skills132—~1.5kAutomated safety check: PassMIT
Cloudflare Agentssecondsky/claude-skills2271 repos~691Automated safety check: PassMIT
Agents SDKhodgef/apiker1273 repos~3kAutomated safety check: PassMIT
Build MCP Serveranthropics/claude-plugins-official37k1 repos~3kAutomated safety check: PassApache-2.0
Cloudflare Browser Renderingeinverne/dotfiles121—~4.9kAutomated safety check: PassGPL-3.0

Similar skills

  • Building MCP Server On Cloudflare

    CommandCodeAI/agent-skills

    Builds remote MCP (Model Context Protocol) servers on Cloudflare Workers with tools, OAuth authentication, and production deployment.

    132 GitHub stars~1.5k tokensUpdated 7 mo ago
    Agent WorkflowsAuto-check passed
  • Cloudflare Agents

    secondsky/claude-skills

    Build AI agents on Cloudflare Workers with MCP integration, tool use, and LLM providers.

    227 GitHub starsUsed in 1 repo~691 tokens
    Agent WorkflowsAuto-check passed
  • Agents SDK

    hodgef/apiker

    Build AI agents on Cloudflare Workers using the Agents SDK. An agent skill from hodgef/apiker.

    127 GitHub starsUsed in 3 repos~3k tokens
    Backend & APIsAuto-check passed
  • Build MCP Server

    anthropics/claude-plugins-official

    Official

    Entry point for building an MCP server: asks about the use case, picks a deployment model and tool-design pattern, then hands off to more specialized skills.

    37k GitHub starsUsed in 1 repo~3k tokens
    Agent WorkflowsAuto-check passed
  • Guide for implementing Cloudflare Browser Rendering - a headless browser automation API for screenshots, PDFs, web scraping, and testing.

    121 GitHub stars~4.9k tokensUpdated 28 days ago
    Productivity & AutomationAuto-check passed
  • Turnstile Testing

    jumodada/Drissionpage-MCP-Server

    A skill your agent uses when testing an authorized Cloudflare Turnstile integration or operating an authorized production challenge with drissionpage-mcp.

    487 GitHub stars~1.7k tokensUpdated 23 days ago
    Agent WorkflowsAuto-check passed

More from cloudflare/skills

All 16 skills in this repo
  • Turnstile Spin

    cloudflare/skills

    Official

    Set up, repair, or migrate to Cloudflare Turnstile bot verification in an existing frontend and backend, including server-side Siteverify.

    3k GitHub starsUsed in 4 repos~7.2k tokens
    Auto-check: notes
  • Nextjs On Cloudflare

    cloudflare/skills

    Official

    Build, migrate, and deploy Next.js apps on Cloudflare Workers with vinext.

    3k GitHub starsUsed in 2 repos~678 tokens
    Auto-check passed
  • Durable Objects

    cloudflare/skills

    Official

    Build, debug, or review Cloudflare Durable Objects code for persistent state and coordination.

    3k GitHub starsUsed in 2 repos~1.5k tokens
    Auto-check passed
  • Sandbox Next

    cloudflare/skills

    Official

    Build or maintain Cloudflare Sandbox apps on @cloudflare/sandbox@next (SDK 1.0 preview).

    3k GitHub starsUsed in 2 repos~1.7k tokens
    Auto-check passed
  • Cloudflare One Migrations

    cloudflare/skills

    Official

    Assess and plan migrations from existing VPN, SWG, or SASE platforms to Cloudflare One, including policy mapping, parity gaps, and rollout.

    3k GitHub starsUsed in 6 repos~3.1k tokens
    Auto-check passed
  • Workers Best Practices

    cloudflare/skills

    Official

    Cloudflare Workers best practices for production applications.

    3k GitHub starsUsed in 2 repos~1.4k tokens
    Auto-check passed

Questions about Agents SDK

What does Agents SDK do?

Build, debug, or review Cloudflare Agents SDK applications using the agents package. Agents SDK is an agent skill from cloudflare/skills, published by the product's own GitHub organization. Build, debug, or review Cloudflare Agents SDK applications using the agents package.

When should I use Agents SDK?

Agents SDK fits situations like: tasks that involve MCP servers.

How do I install Agents SDK in Claude Code?

Run `npx skills add cloudflare/skills --skill agents-sdk -a claude-code`. Or copy the skill folder (skills/agents-sdk in cloudflare/skills) into .claude/skills/agents-sdk in your project. Claude Code loads it when a task matches its description.

How do I install Agents SDK in Codex?

Run `npx skills add cloudflare/skills --skill agents-sdk -a codex`. Or copy the skill folder (skills/agents-sdk in cloudflare/skills) into .agents/skills/agents-sdk in your project. Codex loads it when a task matches its description.

Can I use Agents SDK in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add cloudflare/skills --skill agents-sdk -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/agents-sdk, .gemini/skills/agents-sdk, .github/skills/agents-sdk and .opencode/skills/agents-sdk in your project.

What does Agents SDK need to run?

Going by SKILL.md and its folder, Agents SDK needs the command-line tools its instructions call (npm). Our summary lists: Node.js.

Does Agents SDK access the network?

SKILL.md names 2 domains. As links in the text: developers.cloudflare.com and github.com. This is read from the text; nothing was executed.

Is Agents SDK safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Agents SDK use?

Agents SDK is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Agents SDK use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 8.9k tokens, read only when the agent opens those files.

What are the alternatives to Agents SDK?

Skills that share tags, products or a category with Agents SDK: Building MCP Server On Cloudflare (CommandCodeAI/agent-skills, 132 stars), Cloudflare Agents (secondsky/claude-skills, 227 stars), Agents SDK (hodgef/apiker, 127 stars) and Build MCP Server (anthropics/claude-plugins-official, 37k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Agents SDK?

cloudflare (a GitHub organization, an official publisher) maintains it in cloudflare/skills, which has 2,999 GitHub stars. The repository holds 16 skills in this directory. The repository was last updated on October 1, 2026.

Source: cloudflare/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.