agents-sdk

Build AI agents on Cloudflare Workers with SQLite-backed state and callable RPC.

Updated Jan 4, 2026
One-click install
npx skills add https://github.com/devsanthoshmk/MKS-Agency --skill agents-sdk-devsanthoshmk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agents-sdk
Source: https://github.com/devsanthoshmk/MKS-Agency/tree/main/backend/.agents/skills/agents-sdk
Command: npx skills add https://github.com/devsanthoshmk/MKS-Agency --skill agents-sdk-devsanthoshmk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Cloudflare Workers apps need an easy, reliable way to run AI agents with persistent state, callable actions, and durable workflows, without building all the infrastructure from scratch.

Core Features & Use Cases

  • Persistent agent state with SQLite-backed durability and automatic client synchronization.
  • Callable RPC via WebSocket using @callable methods, including streaming responses for real-time UX.
  • Durable Workflows using AgentWorkflow for multi-step background execution, retries, and human-in-the-loop approvals.
  • Scheduling with delays, cron, and fixed intervals for automated tasks.
  • MCP integration to connect agents to external MCP servers and expose tools/resources/prompting.
  • Email handling to receive and securely reply to emails via Cloudflare Email Routing.
  • React hooks (client SDK) to integrate agent state and chat experiences into React apps.

Quick Start

Fetch the latest Agents SDK docs from https://github.com/cloudflare/agents/tree/main/docs and implement an Agent subclass with typed state, a validateStateChange hook, and at least one @callable method that updates state.

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 AI agents on Cloudflare Workers by subclassing the Agent class, defining durable SQLite-backed state in Wrangler, and routing requests with routeAgentRequest to enable persistent state and callable RPC.

Can I use callable RPC and WebSocket streaming with Cloudflare agents?

Yes, callable RPC and WebSocket streaming are supported by using @callable methods on your Agent subclass, enabling real-time streaming responses and client interactions over WebSockets.

How do I implement durable workflows with human-in-the-loop approvals?

Durable workflows with human-in-the-loop approvals are implemented using AgentWorkflow, which handles multi-step background execution, retries, and scheduled delays for automated task processing.

Does the Cloudflare Agents SDK support MCP integration?

Yes, MCP integration is supported, allowing your agents to connect to external MCP servers to expose tools, resources, and prompting capabilities within your Cloudflare Workers applications.

What is the best way to persist agent state without building custom infrastructure?

The best way to persist agent state without custom infrastructure is using the SDK's SQLite-backed durability, which provides automatic client synchronization and validates state changes via a validateStateChange hook.