agents-sdk

Build stateful AI agents on Cloudflare Workers using the Agents SDK.

3|Updated Nov 8, 2014
One-click install
npx skills add https://github.com/mintuz/.dotfiles --skill agents-sdk-mintuz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agents-sdk
Source: https://github.com/mintuz/.dotfiles/tree/main/agents/.agents/skills/agents-sdk
Command: npx skills add https://github.com/mintuz/.dotfiles --skill agents-sdk-mintuz

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Building AI agents that maintain persistent state, handle real-time WebSocket connections, and survive restarts requires complex infrastructure. This Skill provides up-to-date guidance for the Cloudflare Agents SDK, prioritizing retrieval from official docs over potentially outdated training knowledge. ## Core Features & Use Cases - Stateful Agents: Create Agent classes with SQLite-backed state, @callable RPC methods, scheduling, and automatic client sync via React hooks like useAgent. - Chat & Streaming: Build streaming chat agents with AIChatAgent, resumable streams, tool calling, and human-in-the-loop approval flows. - Background Processing: Coordinate durable Workflows, built-in FIFO queues, retries with backoff, and durable execution fibers that survive Durable Object eviction. - Use Case: Build a customer support chat agent that persists conversation history, schedules follow-up reminders, connects to MCP servers for external tools, and streams responses to a React frontend. ## Quick Start Ask the AI to create a Cloudflare Worker agent class with persistent state and a callable RPC method using the Agents SDK.

Frequently Asked Questions about agents-sdk

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

FAQPage Schema
How do I create a stateful agent on Cloudflare Workers?

Extend the Agent class from the agents package, define an initialState, and register a Durable Object binding with a new_sqlite_classes migration in wrangler.jsonc. Route requests with routeAgentRequest and expose methods to clients using the @callable decorator.

How do I build a streaming chat agent with the Agents SDK?

Extend AIChatAgent from @cloudflare/ai-chat and implement onChatMessage using streamText from the AI SDK. Pass abortSignal and onFinish for proper cleanup and message persistence; streams resume automatically on client reconnect.

Can Cloudflare agents connect to MCP servers?

Yes, agents include a multi-server MCP client via this.addMcpServer, supporting OAuth flows and Streamable HTTP, SSE, or RPC transports. You can also build MCP servers by extending McpAgent and serving them with MyMCP.serve.

Why does @callable break with experimentalDecorators in tsconfig?

Enabling experimentalDecorators in tsconfig conflicts with the decorator implementation used by @callable, breaking RPC method exposure. Extend the agents/tsconfig base configuration instead, which sets the correct compiler options.

When should I use Workflows instead of agent queues?

Use the built-in queue() for background tasks under 30 seconds with sequential FIFO processing. Use AgentWorkflow for long-running multi-step tasks, automatic retries, and human-in-the-loop approval flows that must survive failures.