agents-sdk

Build Cloudflare AI agents on Workers with durable stateful execution.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/mpsuesser/workspace --skill agents-sdk-mpsuesser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agents-sdk
Source: https://github.com/mpsuesser/workspace/tree/main/dotconfig/pi/agent/skills/.deprecated/cloudflare/agents-sdk
Command: npx skills add https://github.com/mpsuesser/workspace --skill agents-sdk-mpsuesser

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you build production-capable AI agents on Cloudflare Workers by providing the patterns and APIs needed for durable, stateful, tool-using agent behavior instead of piecing together infrastructure manually.

Core Features & Use Cases

  • Persistent Agent State: Use SQLite-backed state with validation and client synchronization for consistent conversational and operational behavior.
  • Callable RPC Methods: Expose agent functions via WebSocket RPC (including streaming) so external services or browser clients can trigger precise actions.
  • Durable Workflows and Execution: Run multi-step background tasks and resumable execution so long-running or failure-prone jobs remain reliable.
  • Queues, Retries, and Observability: Process tasks reliably with FIFO queues, backoff/jitter retries, and diagnostics events for debugging and monitoring.

Quick Start

Use the agents-sdk Skill to implement a Cloudflare Worker agent that exposes a callable method for updating and validating persisted state using routeAgentRequest for request routing.

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?

You can build stateful Cloudflare AI agents by using the Agents SDK patterns for SQLite-backed state validation, WebSocket RPC routing, and durable multi-step workflows. This provides persistent conversational and operational behavior without manual infrastructure assembly.

How does durable workflow execution work with Cloudflare Agents?

Durable workflows in Cloudflare Agents use runWorkflow and runFiber execution patterns to run multi-step background tasks. This ensures long-running or failure-prone jobs remain reliable and resumable across worker invocations.

Can I expose callable RPC methods to browser clients using Cloudflare Workers?

Yes, you can expose callable RPC methods via WebSocket RPC, including streaming responses. This allows external services or browser clients to trigger precise agent actions and update persisted state directly.

What is the best way to manage agent state and retries in Cloudflare Workers?

Managing agent state and retries involves using SQLite-backed state with client synchronization alongside FIFO queues with backoff and jitter retries. This combination ensures consistent agent behavior and reliable background task processing.

Do I need MCP integration to build tool-driven agents on Cloudflare?

MCP integration is supported but not strictly required for all agents. You can build tool-driven Cloudflare agents using callable RPC and durable workflows, while adding MCP server and client integrations when external tool connectivity is needed.

How do I route requests to a Cloudflare AI agent with durable state?

You route requests to a stateful Cloudflare AI agent by using the routeAgentRequest function. This handles WebSocket and HTTP routing to trigger specific agent actions and validate persisted state.