agents-sdk

Build stateful Cloudflare Workers AI agents with SQLite-backed state and durable workflows.

17|1|Updated Feb 2, 2024
One-click install
npx skills add https://github.com/FormalSnake/dotfiles --skill agents-sdk-formalsnake
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agents-sdk
Source: https://github.com/FormalSnake/dotfiles/tree/main/users/kyandesutter/claude/skills/agents-sdk
Command: npx skills add https://github.com/FormalSnake/dotfiles --skill agents-sdk-formalsnake

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It solves the problem of building reliable, stateful AI agent backends on Cloudflare Workers without stitching together separate systems for state, RPC, scheduling, and durable execution.

Core Features & Use Cases

  • Persistent agent state: store and sync SQLite-backed state with client updates via setState and onStateUpdate.
  • Callable RPC for agents: expose agent methods to clients using @callable, including streaming responses and timeouts.
  • Durable workflows and execution: run background tasks with AgentWorkflow and durable fibers that survive eviction using runWorkflow and runFiber/stash.
  • Use case: create a chat agent that supports long-running tool workflows, scheduled follow-ups, and resumable streaming for a real-time UI session.

Quick Start

Ask an AI to generate a minimal Cloudflare Workers Agent using an Agent subclass with a SQLite state type, a single @callable method, and a fetch handler that routes requests using routeAgentRequest.

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?

To build stateful AI agents on Cloudflare Workers, define an Agent subclass with typed state and bindings in wrangler.jsonc, using routeAgentRequest for fetch routing and SQLite-backed setState for persistent state.

How does durable workflow execution work for Cloudflare Workers?

Durable workflow execution for Cloudflare Workers runs background tasks using AgentWorkflow and durable fibers that survive eviction via runWorkflow and runFiber/stash, ensuring resilient execution without data loss.

Can I stream real-time responses from a callable RPC method in Cloudflare Workers?

Yes, you can stream real-time responses from callable RPC methods by annotating agent behaviors with @callable, which supports streaming responses and timeouts over WebSocket connections for real-time UI sessions.

What is the best way to integrate an MCP client with a stateful agent backend?

The best way to integrate an MCP client with a stateful agent backend is using a unified SDK that supports MCP client and server integrations directly within the Agent class alongside durable workflows and persistent state.

Do I need durable objects to run scheduled and cron tasks for AI agents?

Yes, you need durable objects configuration and migrations to run scheduled and cron tasks, as durable objects provide the underlying eviction-resistant execution environment for resilient agent workflows.