Skip to content
Agentmart
Submit a tool
This entry duplicates agents-sdk, which is the one we list in search.

agents-sdk

Build AI agents on Cloudflare Workers using the Agents SDK.

Skill by involvex

IndexedMIT★ 1
Write a review

Chalk Labs

Need help deploying agents-sdk?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/involvex-agents-sdk-7e785c

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Build AI agents on Cloudflare Workers using the Agents SDK. Load when creating stateful agents, durable workflows, real-time WebSocket apps, scheduled tasks, MCP servers, or chat applications. Covers Agent class, state management, callable RPC, Workflows integration, and React hooks.

Use cases: frontend, cloud, agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions: not checked yet.

What's inside

Skill name
agents-sdk
Description
Build AI agents on Cloudflare Workers using the Agents SDK. Load when creating stateful agents, durable workflows, real-time WebSocket apps, scheduled tasks, MCP servers, or chat applications. Covers Agent class, state management, callable RPC, Workflows integration, and React hooks.
License
MIT
Instructions
154 lines in SKILL.md · view on GitHub

Files (8)

  • SKILL.md
  • callable.md · references/
  • codemode.md · references/
  • email.md · references/
  • mcp.md · references/
  • state-scheduling.md · references/
  • streaming-chat.md · references/
  • workflows.md · references/

SKILL.md (first lines)

---
name: agents-sdk
description: Build AI agents on Cloudflare Workers using the Agents SDK. Load when creating stateful agents, durable workflows, real-time WebSocket apps, scheduled tasks, MCP servers, or chat applications. Covers Agent class, state management, callable RPC, Workflows integration, and React hooks.
---

# Cloudflare Agents SDK

**STOP.** Your knowledge of the Agents SDK may be outdated. Prefer retrieval over pre-training for any Agents SDK task.

## Documentation

Fetch current docs from `https://github.com/cloudflare/agents/tree/main/docs` before implementing.

| Topic               | Doc                           | Use for                                        |
| ------------------- | ----------------------------- | ---------------------------------------------- |
| Getting started     | `docs/getting-started.md`     | First agent, project setup                     |
| State               | `docs/state.md`               | `setState`, `validateStateChange`, persistence |
| Routing             | `docs/routing.md`             | URL patterns, `routeAgentRequest`, `basePath`  |
| Callable methods    | `docs/callable-methods.md`    | `@callable`, RPC, streaming, timeouts          |
| Scheduling          | `docs/scheduling.md`          | `schedule()`, `scheduleEvery()`, cron          |
| Workflows           | `docs/workflows.md`           | `AgentWorkflow`, durable multi-step tasks      |
| HTTP/WebSockets     | `docs/http-websockets.md`     | Lifecycle hooks, hibernation                   |
| Email               | `docs/email.md`               | Email routing, secure reply resolver           |
| MCP client          | `docs/mcp-client.md`          | Connecting to MCP servers                      |
| MCP server          | `docs/mcp-servers.md`         | Building MCP servers with `McpAgent`           |
| Client SDK          | `docs/client-sdk.md`          | `useAgent`, `useAgentChat`, React hooks        |
| Human-in-the-loop   | `docs/human-in-the-loop.md`   | Approval flows, pausing workflows              |
| Resumable streaming | `docs/resumable-streaming.md` | Stream recovery on disconnect                  |

Cloudflare docs: https://developers.cloudflare.com/agents/

## Capabilities

The Agents SDK provides:

- **Persistent state** - SQLite-backed, auto-synced to clients
- **Callable RPC** - `@callable()` methods invoked over WebSocket
- **Scheduling** - One-time, recurring (`scheduleEvery`), and cron tasks
- **Workflows** - Durable multi-step background processing via `AgentWorkflow`
- **MCP integration** - Connect to MCP servers or build your own with `McpAgent`
- **Email handling** - Receive and reply to emails with secure routing
- **Streaming chat** - `AIChatAgent` with resumable streams
- **React hooks** - `useAgent`, `useAgentChat` for client apps

## FIRST: Verify Installation

```bash
npm ls agents  # Should show agents package
```

If not installed:

```bash
npm install agents
```

## Wrangler Configuration

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

## Agent Class

```typescript
import { Agent, routeAgentRequest, callable } from "agents";

type State = { count: number };

export class Counter extends Agent<Env, State> {
  initialState = { count: 0 };

  // Validation hook - runs before state persists (sync, throwing rejects the update)
  validateStateChange(nextState: State, source: Connection | "server") {
    if (nextState.count < 0) throw new Error("Count cannot be negative");
  }

  // Notification hook - runs after state persists (async, non-blocking)
  onStateUpdate(state: State, source: Connection | "server") {
    console.log("State updated:", state);
  }

  @callable()
  increment() {
    this.setState({ count: this.state.count + 1 });
    return this.state.count;
  }
}

export default {
  fetch: (req, env) =>
    routeAgentRequest(req, env) ?? new Response("Not found", { status: 404 }),
};
```

## Routing

Requests route to `/agents/{agent-name}/{instance-name}`:

| Class      | URL                        |
| ---------- | -------------------------- |
| `Counter`  | `/agents/counter/user-123` |
| `ChatRoom` | `/agents/chat-room/lobby`  |

Client: `useAgent({ agent: "Counter", name: "user-123" })`

## Core APIs

| Task                | API                                                    |
| ------------------- | ------------------------------------------------------ |
| Read state          | `this.state.count`                                     |
| Write state         | `this.setState({ count: 1 })`                          |
| SQL query           | `` this.sql`SELECT * FROM users WHERE id = ${id}` ``   |
| Schedule (delay)    | `await this.schedule(60, "task", payload)`             |
| Schedule (cron)     | `await this.schedule("0 * * * *", "task", payload)`    |

From involvex/syncstuff, MIT.

More from involvex/syncstuff

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Apr 22, 2026 (6 months ago)
Last release
Jan 7, 2026 (9 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

Same skill elsewhere

Copies of this SKILL.md published by others; search shows only one of them.

More from involvex

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get agents-sdk running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying agents-sdk?

CallGet help
Cite this page

agents-sdk skill. Agent Mart. https://agentmart.dev/skills/involvex-agents-sdk-7e785c (last updated 2026-10-24)