Cloudflare Agents

Build persistent, real-time, stateful AI agents on Cloudflare.

Stars
★ 6.2k
Last updated
today [email protected]
FARS reviewed
Nov 07, 2026 +4 new
License
MIT
Primary language
TypeScript

At a glance

How it runs
CLILibrary / SDKFramework
Works with
Platform-specific
Cost
Free software; you pay for model usage
Setup effort
Medium · a few setup steps
You'll need
Cloudflare Durable ObjectsNode.js 24+pnpmShell / CLINetwork access
Typical use
A SaaS team that needs isolated, durable state for each user or session can map every agent to a Durable Object that hibernates when unused.
Not a fit if
  • Teams that must run agents outside Cloudflare's runtime
  • Teams unwilling to manage Durable Object bindings and SQLite migrations
  • Outside contributors wanting to submit pull requests
Maintenance
Commits in the last 30 dayslast commit 2026-12-02latest release [email protected] (2026-11-25)+9.6 ★/day over 7 days
Source review
72/100 · Some gaps

What does this agent do, and when should you use it?

Cloudflare Agents is a TypeScript SDK for building and deploying agents backed by Durable Objects, with independent state, storage, and lifecycle. Its core Agent class exposes persistent state, type-safe RPC, scheduling, WebSockets, SQLite, MCP, workflows, email, and observability interfaces. The repository also supplies layered packages such as @cloudflare/ai-chat, @cloudflare/think, @cloudflare/codemode, @cloudflare/shell, and @cloudflare/voice, plus React and vanilla JavaScript clients. Instances hibernate while idle, wake on demand, and can synchronize state changes across connected clients. It is a strong fit for teams already using, or prepared to adopt, Cloudflare Workers and Durable Objects; the core execution and deployment model is tied to that platform.

On the server, an application subclasses Agent<Env, State>, declares initial state and lifecycle behavior, and marks type-safe client-callable methods with @callable(). routeAgentRequest() routes incoming Worker requests to the appropriate agent instance. The Durable Object persists the agent's state and can broadcast updates to connected React or vanilla JavaScript clients. Applications connect through useAgent, useAgentChat, useVoiceAgent, AgentClient, or VoiceClient, and may schedule one-off, recurring, or cron tasks. Optional packages add persistent chat and resumable streams, server and client tool execution, MCP server and client support, approval-based durable workflows, voice processing, email, x402 payments, and browser-tab agents. Code Mode lets models produce executable TypeScript that calls tools, while @cloudflare/shell runs generated JavaScript in an isolated Worker with a virtual filesystem.

  1. A SaaS team that needs isolated, durable state for each user or session can map every agent to a Durable Object that hibernates when unused.
  2. A frontend team building a multiplayer room, game room, or collaborative interface can use WebSocket lifecycle hooks and automatic state synchronization.
  3. A TypeScript team developing a chat assistant can use @cloudflare/ai-chat for stored messages, resumable streaming, and coordinated server or client tools.
  4. A business system that runs long-lived tasks with approval gates can implement durable, pausable, human-in-the-loop processes through Workflows.
  5. A developer integrating an MCP tool environment can expose an agent as an MCP server or connect it to MCP services over HTTP, SSE, or RPC with elicitation.
  6. A team creating a voice or telephone assistant can use @cloudflare/voice for STT, TTS, VAD, streaming, and interruption handling.

Key setup facts

Pulled from the install and usage notes below. The project README has the current values.

Install / run
  • npm install agents
Config files
wrangler.jsonc
Runtime
Node.js 24+

How do you install or deploy this agent?

For a new project, run npm create cloudflare@latest -- --template cloudflare/agents-starter. To add the SDK to an existing project, run npm install agents. Repository development requires Node.js 24+ and uses pnpm workspaces; the documented source workflow is pnpm install, pnpm run build, pnpm run check, and pnpm run test. The supplied material does not specify the required Cloudflare credentials, login command, or final deployment command, so those deployment steps cannot be stated from this source.

How do you use this agent?

Define a class such as CounterAgent extends Agent<Env, CounterState>, set initialState = { count: 0 }, and decorate remotely callable methods such as increment() and decrement() with @callable(). Invoke routeAgentRequest(request, env) from the Worker's fetch handler. In wrangler.jsonc, add a Durable Object binding whose name and class_name identify CounterAgent, then register it under new_sqlite_classes in a migration; the example also sets compatibility_date to 2026-06-11 and enables nodejs_compat. A React client connects with useAgent({ agent: "CounterAgent", onStateUpdate }) and calls a method through agent.stub.increment(). To run the repository's playground example locally, execute cd examples/playground followed by npm start.

Safety boundaries, hardening & integrations

Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.

Declared capability surface (blast radius)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

What are this agent's strengths and limitations?

Pros
  • Each agent receives isolated state, storage, and lifecycle management, with persistence across restarts and automatic synchronization to connected clients.
  • One SDK family covers RPC, scheduling, WebSockets, chat, MCP, workflows, email, voice, payments, SQL, and observability, reducing the amount of infrastructure teams must assemble.
  • Idle instances hibernate and wake on demand, making the model suitable for large numbers of per-user, per-session, or per-room agents.
  • Both React hooks and vanilla JavaScript clients are provided, with shared TypeScript types supporting type-safe remote method calls.
  • The repository includes more than 30 self-contained examples, architecture records, and pattern guides covering concrete integration scenarios.
Limitations
  • Core state and lifecycle behavior depend on Cloudflare Durable Objects, so moving to another runtime would require those platform services to be reimplemented.
  • Every Durable Object agent needs a binding and SQLite migration, adding deployment configuration and migration-management overhead.
  • Source development requires Node.js 24+ and uses pnpm with Nx, which may conflict with teams standardized on other Node versions or package managers.
  • Earlier AI chat import paths are deprecated; existing applications must migrate to @cloudflare/ai-chat, while new projects must also evaluate @cloudflare/think.
  • The repository is not currently accepting external pull requests, limiting outside contributors to issues and discussions.
  • Features under experimental/ carry no stability guarantee and should not be treated as dependable production APIs.

How does this agent compare with similar options?

The repository offers several internal abstraction levels. agents is the core SDK; @cloudflare/ai-chat concentrates on persistent messages, resumable streams, and tool execution; and @cloudflare/think is an opinionated chat-agent base recommended for new chat-from-scratch projects. Frontends can choose React hooks or the non-React AgentClient and VoiceClient. The older agents/ai-chat-agent, agents/chat, agents/ai-react, and agents/ai-types entry points still re-export functionality but are deprecated.

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
Cloudflare Agents This agent 72 · Some gaps CLIFree + model costs ★ 6.2k today TypeScript —
AgentLoom 69 · Some gaps — ★ 168 5d ago Python OpenAI API
Puppetmaster 73 · Some gaps CLIFree + model costs ★ 487 12d ago Python Codex · Claude Code
ReachAI Enterprise Agent Platform 67 · Some gaps Self-hosted serviceFree + model costs ★ 1.1k 3d ago Java OpenAI API

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Some gaps
72/ 100 5-point scale 3.6 / 5
This review covers the source as of Nov 07, 2026. The project has shipped 4 stable release(s) since, which have not been re-reviewed. The score and verdict describe the reviewed version only. Recent releases ↓
Trust 18/29
Reliability 8/14
Adaptability 15/18
Convention 14/18
Effectiveness 12/13
Verifiability 5/8
Why each dimension lost points
Trust18 / 29 · 3.1/5

The source shows several controls: Codemode can gate write tools on human approval, log calls, and roll back actions that define a revert; AGENTS.md prohibits hardcoded secrets, and the authentication guide recommends short-lived signed tokens. However, the ordinary callable-method examples do not show authorization checks, so least privilege and confirmation are not global framework guarantees. The Think tutorial also exposes file read/write/delete tools and custom network tools; sensitive-data protection depends on application configuration. Dependency and setup information is substantial, but the supplied material does not show a dependency vulnerability review or mitigation process.

Reliability8 / 14 · 2.9/5

The README, getting-started guide, and development guidance corroborate the basic Durable Object, binding, and client patterns. However, compatibility_date examples vary across 2025 and 2026, and AGENTS.md describes tests and CI at different scopes, weakening documentation consistency. Runtime and development dependencies are described adequately. Codemode documents pause, error outcomes, and approval races; the Inference Buffer sample also returns HTTP errors, but the evidence does not establish consistent diagnostics across every product path.

Adaptability15 / 18 · 4.2/5

The material covers beginner tutorials, React and Vanilla JS clients, MCP, workflows, voice, code execution, and multiple integration examples. Package and experimental boundaries are partly stated, but the SDK has a broad capability surface, and users must configure application authorization, code execution, and deployment responsibilities. Trigger and integration conditions are reasonably concrete in the examples. Cloudflare Workers, Durable Objects, Node 24+, Wrangler, and Vite requirements are also stated.

Convention14 / 18 · 3.9/5

Repository structure, package roles, documentation entry points, and example directories are clear; setup, development, and troubleshooting guidance are substantial. Package names and import paths are mostly stable, though deprecated AI-chat entry points and wrappers add migration complexity. Some limits are explicit, including experimental instability and shell deprecation, but production boundaries are not covered for every capability. The MIT license text is complete. Changesets and CI/release processes are described, but the sample does not include a complete user-facing release history. An author contact and issue/discussion paths are given, but external PRs are currently not accepted and ownership/support commitments remain limited.

Effectiveness12 / 13 · 4.6/5

The quick example, guided setup, typed client calls, feature directory, and many standalone demos make the material directly usable. Persistent state, real-time sync, scheduling, chat, and tool integrations provide substantial added value. Cost-benefit guidance depends partly on Cloudflare services, account access, and external model providers; the claim that inactive agents cost nothing lacks conditions or pricing boundaries in the supplied evidence, so this does not merit full marks.

Verifiability5 / 8 · 3.1/5

Many feature claims can be traced to documentation examples, configuration snippets, or source samples. The supplied test files and CI workflow corroborate some engineering practices, but the sample is limited and cannot establish coverage of the whole product. Some statements identify themselves as experimental or empirical harness work and distinguish examples from configuration; however, broad claims about scale, cost, and features are not always accompanied by verifiable conditions.

Risks and how to mitigate them
  • Applications should enforce authentication and authorization for callable methods; the example callable methods are not a security boundary.
  • Think workspace tools can write and delete files, and custom tools can access the network; review tool permissions, inputs, and credential scope before deployment.
  • Costs, model services, and Cloudflare account requirements depend on configuration; interpret the zero-cost statement with those conditions in mind.
Evidence confidence: Low Reviewed Nov 07, 2026 Reviewed revision 5c33d89791d6 New commits since this review; the score may not cover them
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/cloudflare-agents.svg)](https://followagents.com/en/agents/cloudflare-agents)
<a href="https://followagents.com/en/agents/cloudflare-agents"><img src="https://followagents.com/badge/cloudflare-agents.svg" alt="FARS review"></a>

Recent releases

Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.

  1. [email protected]
    Release notes excerpt
    Patch Changes - [#3171](https://github.com/cloudflare/agents/pull/3171) [9448cd8](https://github.com/cloudflare/agents/commit/9448cd82e974a16015a66dac8f820a42474c4672) Thanks [@ben-reitz](https://github.com/ben-reitz)! - Support Pi 1.6.1 (~1.6.1). Pi tools now park with { kind: "sleep", signals, until } instead of { sleep: { ... } }, and a signal's state is { kind: "value", value } or { kind: "expired" }; a tool that still returns the old shape compiles but ends with an empty result, so update parking tools when you upgrade. agents/models/pi-ai now matches pi-ai 1.6.1: a c …
    View on GitHub ↗
  2. Release notes excerpt
    This release moves Think to Computer 0.10, and restarting a Think agent no longer creates a new Dynamic Worker for each extension. Highlights - Computer 0.10: Think's @cloudflare/computer peer is now ^0.10.0. Computer's JavaScript backend is now CodemodeBackend, and host modules such as ws:tools are now codemode:tools. See [Running code with exec](https://github.com/cloudflare/agents/blob/main/docs/think/tools.md#running-code-with-exec). …
    View on GitHub ↗
  3. [email protected]
    Release notes excerpt
    This release adds support for [Pi 1.6](https://github.com/earendil-works/pi/blob/v1.6.0/packages/durable/CHANGELOG.md#160---2026-11-20), which lets a Pi tool wait for a person, a deadline or another session without keeping the agent awake, and lets a Pi session start from an existing history. MCP clients now say when a user needs to authorize again, and failed requests no longer send error details to the client. Highlights - Pi 1.6 support: agents/harness/pi, agents/models/pi-ai and the Pi tools now run on Pi 1.6, which brings: …
    View on GitHub ↗

FAQ

Can it be deployed without Cloudflare?
The supplied material documents agents as powered by Cloudflare Durable Objects and requires a Durable Object binding and migration. It provides no alternative self-hosted runtime, so the core deployment should be treated as Cloudflare-specific.
Is MCP required to run an agent?
No. MCP is an optional capability for acting as a server or client; the basic persistent-state, RPC, and real-time synchronization example does not require it.
Do idle agents keep consuming execution resources?
The material states that agents hibernate while idle, wake on demand, and cost nothing when inactive. It does not provide broader pricing details.
Can a non-React frontend use the SDK?
Yes. In addition to useAgent, useAgentChat, and useVoiceAgent, the repository provides AgentClient and VoiceClient for non-React environments.
What is the risk of adopting experimental features?
The experimental/ directory is explicitly reserved for work-in-progress experiments with no stability guarantees. Production systems should favor published packages and assess upgrade risk separately.
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts