agents-sdk

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

Updated Aug 10, 2026
One-click install
npx skills add https://github.com/narr07/permadi --skill agents-sdk-narr07
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: agents-sdk
Source: https://github.com/narr07/permadi/tree/main/.agents/skills/agents-sdk
Command: npx skills add https://github.com/narr07/permadi --skill agents-sdk-narr07

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Building stateful AI agents on Cloudflare Workers requires navigating Durable Objects, WebSocket routing, scheduling, MCP integration, and rapidly evolving SDK APIs. This Skill provides up-to-date retrieval sources, code patterns, and gotchas so you avoid outdated knowledge and common configuration mistakes. ## Core Features & Use Cases - Agent Implementation Guidance: Covers the Agent class, persistent state with setState, @callable RPC methods, scheduling, workflows, durable execution with runFiber, queues, and retries. - Chat & Client Integration: Documents AIChatAgent streaming chat, React hooks (useAgent, useAgentChat), server-driven messages, and human-in-the-loop approval flows. - Integrations & Experimental APIs: Includes MCP client/server setup, email handling, webhooks, push notifications, observability, plus experimental voice, browser tools, Think, and Codemode. - Use Case: You need to add a streaming chat agent with scheduled reminders to an existing Workers app. The Skill points you to the correct wrangler configuration, migration rules, and current documentation for each step. ## Quick Start Ask the AI to create a Cloudflare agent class with state, a callable method, and the correct wrangler.jsonc configuration using the agents-sdk skill.

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 Cloudflare agent with the agents SDK?▼

Install the agents package, extend the Agent class with an initialState, and route requests with routeAgentRequest. Add a Durable Object binding and a new_sqlite_classes migration entry in wrangler.jsonc for each agent class.

How do I build a streaming chat agent on Cloudflare Workers?▼

Use AIChatAgent from the agents SDK with @cloudflare/ai-chat and the AI SDK to stream model responses with persisted messages and tools. On the client, connect with the useAgent and useAgentChat React hooks.

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 new tags for new classes, and avoid enabling experimentalDecorators in tsconfig.

Can Cloudflare agents connect to MCP servers?▼

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

Why does my Cloudflare agent routing return namespace not found?▼

This error means the class_name in wrangler.jsonc does not match your exported agent class. Also verify the URL uses the kebab-case class name, such as /agents/my-agent/instance-name for MyAgent.

When should I use Workflows instead of agent scheduling?▼

Use Workflows when a task needs durable multi-step execution, independent retries, or waits for external approval. Use built-in scheduling or the queue for simpler one-time, cron, or sequential background work within an agent.