Cloudflare Agents SDK for Openclaw

A powerful agent skill for building and deploying stateful, durable AI agents, WebSocket-enabled applications, and background workflows on Cloudflare Workers.

creativerezz
v1.0.0
Jun 11, 2026
0
472
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install agents-sdk

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install agents-sdk using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Cloudflare Agents SDK?

The Cloudflare Agents SDK skill enables developers to construct highly resilient, stateful AI agents directly on top of the Cloudflare Workers global network. Integrating this skill allows your developer workflow to seamlessly leverage persistent state, real-time WebSocket communication, and durable execution primitives. With built-in features like SQLite-backed state management, callable Remote Procedure Calls (RPC), and resilient background execution, the SDK is perfect for creating chat agents, voice systems, and autonomous digital workers.

Deploying these agents utilizing Openclaw Skills maximizes your control over long-lived multi-step tasks. By tapping into durable objects and automated workflows, developers can confidently build production-grade agentic architectures. This integration delivers the foundational patterns, routing configuration, and API blueprints needed to successfully execute workflows on the edge.

Cloudflare Agents SDK Use Cases

  • Building real-time interactive chat agents and voice companions with stateful contexts and tool execution capabilities using Openclaw Skills.
  • Orchestrating complex, multi-step background tasks that require durable execution and resilient fiber states to handle transient network issues.
  • Constructing lightweight, scalable Model Context Protocol (MCP) servers and clients on the Cloudflare global edge network.
  • Implementing server-driven push notifications, external webhook handlers, and web scraping agents that automate browser actions.

How Cloudflare Agents SDK Works

  1. Agent Setup and Deployment: Define the agent state, rules, and @callable endpoints in your Cloudflare Workers script, establishing a SQLite-backed state synchronized seamlessly.
  2. Routing Connection: Client requests are automatically routed via /agents/{agent-name}/{instance-name} or handled through custom handlers.
  3. State Management and Synced Execution: The agent synchronizes its state changes via WebSocket, calling lifecycle hooks and saving messages as operations process.
  4. Task Scheduling and Queues: Time-delayed actions, cron sequences, or FIFO queue items are managed and retries with backoff are automatically executed to survive worker evictions.
  5. Integration with Openclaw Skills Ecosystem: Developers pair these edge agent patterns with Openclaw Skills to design powerful client-side workflows, leveraging React hooks or CLI interfaces.

Cloudflare Agents SDK Setup

Ensure your environment has the correct packages installed. Start by verifying or running the installation commands:

npm ls agents

If the package is not yet installed in your project, install it with npm:

npm install agents

For chat-centric agents, make sure to install the companion AI SDK libraries:

npm install agents @cloudflare/ai-chat ai @ai-sdk/react

Add the necessary configuration inside your wrangler.jsonc file to enable Durable Object bindings and database migrations:

{
  "compatibility_flags": ["nodejs_compat"],
  "durable_objects": {
    "bindings": [{ "name": "MyAgent", "class_name": "MyAgent" }]
  },
  "migrations": [{ "tag": "v1", "new_sqlite_classes": ["MyAgent"] }]
}

Note: Ensure you do not enable experimentalDecorators in your tsconfig.json to prevent breaking the @callable decorator structure.

Cloudflare Agents SDK Data Schema & Taxonomy

The Cloudflare Agents SDK organizes and tracks state using SQLite-backed structures natively bound to Durable Objects. State changes must pass validation and trigger sync handlers across client connections.

Configuration Type Binding / Tag Requirement Purpose
durable_objects bindings key matching class name Binds the persistent state agent to the global route
migrations Unique migration tags (e.g., v1, v2) Creates SQLite-backed schemas without rewriting historical migrations
ai AI binding key Links the agent with Workers AI models and tools

For state serialization, the typical payload structure consists of simple state models:

type State = {
  count: number;
  messages?: Array<{ role: string; content: string }>;
};

Cloudflare Agents SDK Advanced Features

  • Durable Fiber Execution: Utilize runFiber() and stash() to write code blocks that survive Worker eviction and process complex sequences to completion.
  • Built-in FIFO Queues: Run asynchronous message handlers using this.queue() complete with automatic exponential backoff and jitter configurations via this.retry().
  • Secure MCP Routing: Seamlessly expose Model Context Protocol server capabilities using McpAgent and secure transport layers like SSE and RPC with Openclaw Skills implementations.
  • Browser Automation Integration: Execute browser tasks directly from your edge code using experimental browser tools and Chrome DevTools Protocol integrations.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*