agents-sdk

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building stateful, real-time agents on Cloudflare Workers requires coordinating Durable Objects, WebSockets, scheduling, RPC, and streaming chat, and outdated knowledge of the fast-moving Agents SDK leads to broken implementations. This Skill provides current documentation pointers, working code patterns, and known gotchas for every major Agents SDK capability. ## Core Features & Use Cases - Agent Implementation Patterns: Ready-to-adapt examples for the Agent class, state persistence, @callable RPC methods, routing, and Wrangler configuration including Durable Object bindings and migrations. - Chat, Streaming & Clients: Guidance for AIChatAgent, resumable streaming, React hooks (useAgent, useAgentChat), server-driven messages, and human-in-the-loop approvals. - Background & Integration Workflows: References for Workflows, durable execution fibers, queues with retries, MCP client/server, email handling, webhooks, push notifications, and experimental features like Think, Voice, Codemode, and browser tools. - Use Case: You need to add a streaming chat agent with scheduled reminders to an existing Workers app. The Skill walks you through installation, wrangler.jsonc bindings, the agent class, and the React client, while flagging pitfalls like enabling experimentalDecorators. ## Quick Start Ask the agent to scaffold a Cloudflare Agents SDK chat agent with state, a callable RPC method, and the correct wrangler.jsonc Durable Object bindings.

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, install agents, @cloudflare/ai-chat, ai, and @ai-sdk/react, then implement onChatMessage with streamText. Configure a Durable Object binding and sqlite migration in wrangler.jsonc, and connect clients with the useAgentChat React hook.

How do I expose agent methods to clients over WebSocket?

Decorate agent methods with @callable() to expose them as RPC methods over WebSocket. Clients invoke them with agent.call("methodName", [args]), and streaming variants use @callable({ streaming: true }) with a StreamingResponse parameter.

What wrangler.jsonc configuration does a Cloudflare agent need?

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 new tags for new classes, and do not enable experimentalDecorators in tsconfig since it breaks @callable.

Think vs AIChatAgent: which chat agent class should I use?

Think handles the streamText loop, tool execution, and persistence automatically via getModel() and getSystemPrompt() overrides, but requires the experimental compatibility flag. AIChatAgent gives full control inside onChatMessage for custom streaming and tool wiring.

Why does my Cloudflare agent routing return namespace not found?

This error means the class_name in your wrangler.jsonc Durable Object binding does not match your exported agent class. Also verify URLs use the kebab-case class name, such as /agents/my-agent/instance-id for a class named MyAgent.

Can Cloudflare agents run scheduled and background tasks?

Yes, agents support one-time, cron, and interval scheduling via this.schedule and scheduleEvery, plus a built-in FIFO queue with this.queue and retries via this.retry. For durable multi-step work, use runWorkflow or runFiber to survive Durable Object eviction.