agents-sdk

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

1|Updated Jul 2, 2026
One-click install
npx skills add https://github.com/filippolmt/skills --skill agents-sdk-filippolmt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agents-sdk
Source: https://github.com/filippolmt/skills/tree/main/skills/agents-sdk
Command: npx skills add https://github.com/filippolmt/skills --skill agents-sdk-filippolmt

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires agents, @cloudflare/ai-chat, @cloudflare/think, @cloudflare/voice, @cloudflare/codemode, web-push, and includes references (resource) components.

What problem does it solve? Building stateful, real-time agents on Cloudflare Workers requires correct Durable Object bindings, migrations, routing, and SDK APIs that change frequently; this Skill grounds every answer in current Cloudflare Agents SDK documentation instead of outdated training knowledge. ## Core Features & Use Cases - Retrieval-first guidance: Maps every Agents SDK topic (state, scheduling, callable RPC, workflows, MCP, email, chat streaming) to the current official documentation URL. - Working code patterns: Provides verified snippets for wrangler.jsonc configuration, Agent class definitions, routing, React client hooks, and common gotchas like avoiding experimentalDecorators. - Deep reference library: Ships 19 reference files covering chat agents, durable execution, queues and retries, human-in-the-loop approvals, voice, browser tools, and observability. - Use Case: You are adding a streaming chat agent to an existing Workers app; the Skill walks you through installing agents and @cloudflare/ai-chat, configuring the Durable Object binding and sqlite migration, and wiring useAgentChat on the client. ## Quick Start Ask the agent to scaffold a Cloudflare Agents SDK chat agent with wrangler configuration, routing, and a React client using the agents package.

Frequently Asked Questions about agents-sdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a chat agent with the Cloudflare Agents SDK?

Extend AIChatAgent from the agents package, install @cloudflare/ai-chat and the AI SDK, and implement onChatMessage with streamText. Configure a Durable Object binding and a new_sqlite_classes migration in wrangler.jsonc, then connect with useAgentChat on the client.

How do I schedule recurring tasks in a Cloudflare agent?

Use this.schedule with a delay, date, or cron expression for one-time and calendar-based work, or this.scheduleEvery for fixed intervals. The agent invokes the named callback method when the schedule fires, with retries configurable via this.retry.

What wrangler configuration does the Agents SDK require?

Each agent class needs a Durable Object binding, a new_sqlite_classes migration entry, and the nodejs_compat compatibility flag. Never edit old migrations; add a new tag for new classes, and do not enable experimentalDecorators in tsconfig since it breaks @callable.

Can Cloudflare agents connect to MCP servers?

Yes, the SDK includes an MCP client API for connecting to remote servers with OAuth support, and createMcpHandler for building your own MCP servers. It supports Streamable HTTP, SSE, and RPC transports, with guidance for securing servers.

Why does my Cloudflare agent lose work when the Durable Object is evicted?

In-flight work is lost on eviction unless you use runFiber, which checkpoints progress to SQLite via ctx.stash. On restart, onFiberRecovered receives the checkpoint so you can resume; for multi-step pipelines with automatic retries, use Workflows instead.

What is the difference between Think and AIChatAgent?

Think is an experimental higher-level class that handles the streamText loop, tool execution, and persistence automatically via getModel and getSystemPrompt overrides. AIChatAgent gives you full control inside onChatMessage but requires wiring the streaming loop yourself.