agents-sdk

Build, debug, and review Cloudflare Agents SDK applications with current documentation.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? The Cloudflare Agents SDK evolves quickly, so pre-trained knowledge of its APIs is often outdated or wrong. This Skill grounds every Agents SDK task in current official documentation, preventing broken code from deprecated patterns, misconfigured Durable Object bindings, and incorrect migration steps. ## Core Features & Use Cases - Retrieval-first guidance: Maps 30+ topics (state, scheduling, callable RPC, workflows, MCP, email, voice) to the exact Cloudflare docs page to consult before writing code. - Configuration guardrails: Provides correct wrangler.jsonc patterns and flags common pitfalls such as enabling experimentalDecorators or editing old migrations. - In-depth references: Ships 17 reference files covering chat agents, streaming, human-in-the-loop approvals, durable execution, queues, retries, webhooks, and experimental features like Think, Voice, and Codemode. - Use Case: When asked to add a streaming chat agent with tool approvals to an existing Workers project, the Skill directs you to the current AIChatAgent and human-in-the-loop docs, then supplies verified wrangler config and client hook patterns. ## Quick Start Ask the assistant to build a Cloudflare agent with persistent state and a callable RPC method, and it will fetch the current docs before writing the code.

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, configure a Durable Object binding and SQLite migration in wrangler.jsonc, and route requests with routeAgentRequest. Install agents, @cloudflare/ai-chat, ai, and @ai-sdk/react, then use useAgentChat on the client for streaming messages and tools.

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 configuration does a Cloudflare agent 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.

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 and runs on standard flags.

Why does my Cloudflare agent routing return namespace not found?

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

Can Cloudflare agents run scheduled and background tasks?

Yes. Use this.schedule() for one-time or cron tasks, scheduleEvery() for intervals, queue() for sequential FIFO work with retries, and runWorkflow() for durable multi-step execution. runFiber() with stash checkpoints survives Durable Object eviction.