agents-sdk

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

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

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 stateful, real-time AI agents requires managing WebSocket connections, persistent state, scheduling, and durable execution, which is complex to implement from scratch on serverless platforms. ## Core Features & Use Cases - Stateful Agents with RPC: Create Agent classes with SQLite-backed state, @callable RPC methods, and automatic client state sync via React hooks like useAgent and useAgentChat. - Durable Background Work: Run scheduled tasks, cron jobs, FIFO queues with retries, durable fibers, and multi-step Workflows with human-in-the-loop approvals. - Chat, MCP, and Integrations: Build streaming chat agents with AIChatAgent, connect to or host MCP servers, handle email, webhooks, push notifications, voice, and browser automation. - Use Case: Build a customer support chat agent that persists conversation history, schedules follow-up checks, calls MCP tools, and resumes streams automatically when users reconnect. ## Quick Start Ask the agent to create a Cloudflare Workers agent using the Agents SDK with a Counter class, state management, and a callable increment method.

Frequently Asked Questions about agents-sdk

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

FAQPage Schema
How do I build an AI agent on Cloudflare Workers?

Install the agents package, extend the Agent class with typed state, and route requests with routeAgentRequest. Configure a Durable Object binding and a new_sqlite_classes migration in wrangler.jsonc for each agent class.

How do I add scheduling to a Cloudflare agent?

Use this.schedule() with a delay in seconds, a Date, or a cron expression, or this.scheduleEvery() for fixed intervals. The handler method receives the payload and schedule object, and cron schedules auto-reschedule.

What is the difference between AIChatAgent and Think?

AIChatAgent gives full control over the streamText loop inside onChatMessage, while Think handles the loop, tool execution, and persistence automatically via getModel() and getSystemPrompt(). Think requires the experimental compatibility flag.

Can Cloudflare agents connect to MCP servers?

Yes, agents include a multi-server MCP client via this.addMcpServer() with OAuth support, and this.mcp.getAITools() exposes MCP tools to the LLM. You can also build MCP servers using the McpAgent class.

Why does @callable break with experimentalDecorators enabled?

Enabling experimentalDecorators in tsconfig conflicts with the decorators used by the Agents SDK and breaks @callable methods. Extend the agents/tsconfig base configuration instead to get correct compiler settings.

When should I use Workflows instead of agent queues?

Use the built-in queue() for background tasks under 30 seconds and Workflows for long-running multi-step tasks needing automatic retries, durable state, or human approval flows via step.waitForEvent.