agents-sdk

Build stateful AI agents with durable state, scheduling, RPC, and streaming on Cloudflare Workers.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/ecnepsyroc-bot/Dejavara --skill agents-sdk-ecnepsyroc-bot
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: agents-sdk
Source: https://github.com/ecnepsyroc-bot/Dejavara/tree/main/deploy/skills/cloudflare-skills/agents-sdk
Command: npx skills add https://github.com/ecnepsyroc-bot/Dejavara --skill agents-sdk-ecnepsyroc-bot

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill reduces the complexity of building persistent, stateful AI agents on Cloudflare Workers by providing guidance for durable object state, scheduling, RPC, email routing, streaming chat, MCP integration, and Code Mode orchestration so developers can focus on agent logic instead of infra plumbing.

Core Features & Use Cases

  • State persistence & typing: Typed state definitions with automatic SQLite-backed persistence and client broadcast for real-time sync.
  • Scheduling, queues & SQL: First-class scheduling (date, delay, cron), serial task queues, and direct SQL access for complex queries and data stores.
  • Streaming chat, RPC & MCP: Streaming chat with resumable streams, callable RPC (including streaming RPC), Code Mode for executable orchestration to reduce token use, and MCP server tool integration and email handling.
  • Use Case: Build a customer support agent that persists conversation history, streams long responses, schedules follow-ups, and coordinates external MCP tools for data enrichment.

Quick Start

Install the agents package, add durable object bindings and SQLite migrations for your Agent class in wrangler, install optional ai and codemode packages for streaming and Code Mode, and deploy the Worker to begin running stateful agents.

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?▼

Stateful AI agents on Cloudflare Workers use durable object bindings and SQLite migrations to persist typed state, enabling scheduling, RPC, streaming chat, and MCP tool integration without manual infrastructure plumbing.

How does streaming chat work with durable objects in a Cloudflare Worker?▼

Streaming chat with durable objects uses resumable streams to send long responses incrementally to the client. The agents package manages the connection state within the durable object, ensuring conversation context persists across requests.

Can I schedule background tasks and cron jobs for persistent agents?▼

Yes, persistent agents support first-class scheduling by date, delay, or cron, alongside serial task queues and direct SQL access for complex queries and background task execution on Cloudflare Workers.

Do I need wrangler SQLite migrations to use the agents SDK?▼

Yes, you need wrangler SQLite migrations. You must add durable object bindings and SQLite migrations for your Agent class in wrangler before deploying the Worker to run stateful agents successfully.

What is Code Mode orchestration for AI agents?▼

Code Mode orchestration executes code to coordinate agent tasks and reduce token usage, enabled via the optional codemode package alongside the ai package for streaming chat on Cloudflare Workers.

How do I integrate an MCP server with a Cloudflare Worker agent?▼

You integrate an MCP server by using the MCP server tool integration features within the agents package. This allows your stateful agent to coordinate external MCP tools for data enrichment and complex operations.