agents-sdk

Build stateful AI agents on Cloudflare Workers with persistent storage and RPC.

2|Updated Apr 26, 2026
One-click install
npx skills add https://github.com/iadr-dev/colab --skill agents-sdk-iadr-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agents-sdk
Source: https://github.com/iadr-dev/colab/tree/main/skills/coding/cloudflare-skills/skills/agents-sdk
Command: npx skills add https://github.com/iadr-dev/colab --skill agents-sdk-iadr-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you build reliable AI agent systems on Cloudflare Workers that can keep memory, run long-lived work, and expose agent actions safely.

Core Features & Use Cases

  • Persistent agent state with validation: Store state in SQLite-backed persistence, sync to clients, and gate updates with validateStateChange.
  • Callable RPC and streaming: Expose agent methods via @callable over WebSocket, including streaming responses with timeouts and error handling.
  • Durable workflows, fibers, and queues: Run durable multi-step workflows (AgentWorkflow), survive Durable Object eviction (runFiber/stash), and process background jobs via a FIFO queue with retries.
  • Real integrations: Route requests, connect to MCP servers (client or server), handle email routing, and trigger proactive turns with server-driven messages.
  • Client support via React hooks: Use useAgent and useAgentChat (and streaming) to build chat and real-time UI around your agents.

Quick Start

Tell your AI to generate a Cloudflare Workers agent using the Agents SDK with persistent state, a @callable increment method, and React useAgentChat wiring for a streaming chat UI.

Frequently Asked Questions about agents-sdk

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

FAQPage Schema
How do I build stateful AI agents on Cloudflare Workers?

Build stateful AI agents on Cloudflare Workers by implementing Agent or AIChatAgent patterns and configuring Wrangler Durable Objects with SQLite-backed persistence. This enables agents to keep memory, run long-lived work, and sync state to clients safely.

How do I expose RPC methods for streaming responses in a Cloudflare agent?

Expose RPC methods in a Cloudflare agent by decorating functions with @callable over WebSocket. This supports streaming responses with timeouts and error handling, allowing clients to invoke agent actions safely in real time.

Can I run durable multi-step workflows and background jobs on Cloudflare Workers?

Run durable multi-step workflows and background jobs on Cloudflare Workers using AgentWorkflow and a FIFO queue with retries. You can survive Durable Object eviction using runFiber and stash primitives to maintain durable execution state.

Does the Cloudflare Agents SDK support MCP integration and email triggers?

The Cloudflare Agents SDK supports MCP integration by connecting to MCP servers as a client or server. It also handles email routing and webhook-driven triggers to proactively start agent turns from external events.

How do I add real-time chat UI for a Cloudflare AI agent?

Add real-time chat UI for a Cloudflare AI agent using React hooks like useAgent and useAgentChat. These hooks wire streaming responses and state synchronization directly into your chat interface components.

How do I validate state changes in a Cloudflare Durable Object agent?

Validate state changes in a Cloudflare Durable Object agent using the validateStateChange method. This gates updates to your persistent SQLite-backed storage, ensuring only valid state transitions occur before syncing to clients.