agents
AGENTS.md5.8k starsChanged 5 months agoMITView on GitHub
Cloudflare Agents SDK — a framework for building stateful AI agents on Cloudflare Workers. This is a monorepo containing the core SDK packages, examples, guides, sites, and documentation. Some directories have their own AGENTS.md with deeper guidance: Node 24+ required. Uses pnpm workspaces with Nx for task orchestration, caching, and affected detection. Run from the repo root: Run an exampl
- Reads credentials
- Installs packages
Trending
More talk lately.about the whole repository
Who's talking about cloudflare/agents
- @threepointone.bsky.social“cloudflare agents: repo: github.com/cloudflare/a... platform docs: developers.cloudflare.com/agents/ …”Bluesky · Feb 25, 2025 · 66 likes
- mastra-ai/mastra“[FEATURE] Code Mode (generate + run code to orchestrate tool/MCP calls)”GitHub · Dec 9, 2025 · 6 reactions
- Chemically-Motivated-Solutions/promptcrafting-mcp“chore(deps): bump the npm_and_yarn group across 3 directories with 4 updates”GitHub · Apr 2, 2026 · 3 reactions
- @github-trending-js.bsky.social“📦 cloudflare / agents ⭐ 1,655 (+76) 🗒 TypeScript Build and deploy AI Agents on Cloudflare”Bluesky · May 2, 2025 · 3 likes
- abstractedfox/agents“Python package resolution”GitHub · Jul 21, 2026 · 2 reactions
The biggest 5 of 43 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 43
Talked about on GitHub, Bluesky and Hacker News (43 times).
On GitHub · 33
- Dec 9, 2025[FEATURE] Code Mode (generate + run code to orchestrate tool/MCP calls) — mastra-ai/mastra6 reactions · 5 comments
- Apr 2, 2026chore(deps): bump the npm_and_yarn group across 3 directories with 4 updates — Chemically-Motivated-Solutions/promptcrafting-mcp3 reactions · 1 comment
- Jul 21, 2026Python package resolution — abstractedfox/agents2 reactions
- Jun 20, 2026chore(deps): bump the npm_and_yarn group across 2 directories with 13 updates — Chemically-Motivated-Solutions/promptcrafting-mcp2 reactions · 1 comment
- May 26, 2026Bump the npm_and_yarn group across 1 directory with 18 updates — GlacierEQ/context-engineering-intro2 reactions · 4 comments
28 more on GitHub
- May 23, 2026Bump the npm_and_yarn group across 1 directory with 9 updates — HarleyCoops/JinaMCP2 reactions · 1 comment
- Apr 14, 2026chore(deps): bump agents from 0.0.87 to 0.11.0 in /templates/cloudflare-mcp-server in the npm_and_yarn group across 1 directory — sipyourdrink-ltd/bernstein2 reactions · 2 comments
- Mar 23, 2026chore(deps): Bump agents from 0.2.35 to 0.7.9 in /packages/api — LoveLogicAILLC/secretforge-ai2 reactions · 4 comments
- Mar 16, 2026chore(deps): Bump agents from 0.2.35 to 0.7.6 in /packages/web — LoveLogicAILLC/secretforge-ai2 reactions · 6 comments
- Mar 16, 2026chore(deps): Bump agents from 0.2.35 to 0.7.6 in /packages/api — LoveLogicAILLC/secretforge-ai2 reactions · 5 comments
- Feb 23, 2026chore(deps): Bump agents from 0.2.35 to 0.5.1 in /packages/web — LoveLogicAILLC/secretforge-ai2 reactions · 6 comments
- Feb 20, 2026Bump the npm_and_yarn group across 3 directories with 8 updates — cbwinslow/opendiscourse_mcp2 reactions · 1 comment
- Jan 24, 2026chore(deps): Bump agents from 0.2.35 to 0.3.6 — LoveLogicAILLC/secretforge-ai2 reactions · 6 comments
- Jan 24, 2026chore(deps): Bump agents from 0.2.35 to 0.3.6 in /packages/web — LoveLogicAILLC/secretforge-ai2 reactions · 6 comments
- Jan 24, 2026chore(deps): Bump agents from 0.2.35 to 0.3.6 in /packages/api — LoveLogicAILLC/secretforge-ai2 reactions · 6 comments
- Aug 11, 2025Unknown connection regression — modelcontextprotocol/inspector2 reactions · 6 comments
- Jul 11, 2025Add instrumentation for `agents` — getsentry/sentry-javascript2 reactions · 10 comments
- Oct 5, 2026build(deps): Bump the minor-and-patch group across 1 directory with 20 updates — Themis128/cloudless.gr1 reaction · 4 comments
- Oct 2, 2026Add `Code Mode` meta tools to Reshapr tools — reshaprio/reshapr1 reaction · 2 comments
- Sep 28, 2026chore(deps): bump the npm-minor-and-patch group across 1 directory with 4 updates — grigoreo-dev/otask-mcp1 reaction · 1 comment
- Sep 25, 2026chore(deps): bump the patch-updates group across 1 directory with 12 updates — ClashKingInc/ClashKingDashboard1 reaction · 1 comment
- Sep 18, 2026chore(deps): bump the patch-updates group with 10 updates — ClashKingInc/ClashKingDashboard1 reaction · 1 comment
- Aug 27, 2026chore(deps): bump the minor-and-patch group across 1 directory with 14 updates — Themis128/cloudless.gr1 reaction · 2 comments
- Jul 29, 2026fix(cloudflare): Also skip cf: prefixed DOs — getsentry/sentry-javascript1 reaction
- Jun 5, 2026Bump agents from 0.13.3 to 0.14.1 — martinthommesen/snow-mcp1 reaction · 1 comment
- Feb 20, 2026chore(deps): Bump the npm_and_yarn group across 4 directories with 4 updates — Fadil369/givc-core-academy1 reaction
- Feb 20, 2026chore(symbolai-worker)(deps): bump agents from 0.2.35 to 0.5.1 in /symbolai-worker — llu77/-lmm1 reaction · 3 comments
- Feb 3, 2026Bump agents from 0.0.109 to 0.3.7 — vivekrp/youfirst-mcp1 reaction
- Feb 3, 2026Bump agents from 0.0.94 to 0.3.7 in /mcp-server-deepwiki-gpt — Cam10001110101/chatgpt-connector-deepwiki1 reaction
- Feb 3, 2026Bump agents from 0.0.65 to 0.3.7 — hackhit/remote-mcp-server-authless1 reaction
- Dec 1, 2025chore(symbolai-worker)(deps): bump the security group in /symbolai-worker with 2 updates — llu77/-lmm1 reaction · 2 comments
- Nov 7, 2025Bump ai and agents — vivekrp/youfirst-mcp1 reaction
- Nov 5, 2025will this be merged soon? — fghf136813721430ghase/fghf136813721430ghase1 reaction
On Bluesky · 9
- Feb 25, 2025cloudflare agents: repo: github.com/cloudflare/a... platform docs: developers.cloudflare.com/agents/ starter kit:… — @threepointone.bsky.social66 likes and reposts · 4 replies
- May 2, 2025📦 cloudflare / agents ⭐ 1,655 (+76) 🗒 TypeScript Build and deploy AI Agents on Cloudflare — @github-trending-js.bsky.social3 likes and reposts
- Mar 7, 2026Cloudflare's official SDK for building and deploying AI Agents - production-grade infrastructure for the agentic era!… — @u11g.com2 likes and reposts
- Feb 27, 2026Cloudflare Agents lets you deploy millions of persistent AI agents that cost nothing when idle - each with its own state, WebSocket sync,… — @arifsolmaz.bsky.social2 likes and reposts
- Feb 21, 2026📦 cloudflare / agents ⭐ 3,303 (+56) 🗒 TypeScript Build and deploy AI Agents on Cloudflare — @github-trending.bsky.social2 likes and reposts
4 more on Bluesky
- Feb 21, 2026📦 cloudflare / agents ⭐ 3,303 (+56) 🗒 TypeScript Build and deploy AI Agents on Cloudflare — @github-trending-js.bsky.social2 likes and reposts
- May 3, 2025📦 cloudflare / agents ⭐ 1,655 (+76) 🗒 TypeScript Build and deploy AI Agents on Cloudflare — @github-trending.bsky.social2 likes and reposts
- Mar 4, 2025Link: github.com/cloudflare/a... — @tinztwinshub.bsky.social1 likes and repost
- Oct 3, 2026Cloudflare Agents is an open-source SDK for stateful agents on Cloudflare Durable Objects. This investigation will examine its runtime,… — @smith.wiki0 likes and reposts · 1 reply
On Hacker News · 1
- Mar 4, 2025Cloudflare Agents1 point
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository15 other files it gives its agents.
- agent-think/AGENTS.mdAGENTS.md
- design/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- examples/AGENTS.mdAGENTS.md
- examples/webmcp-react/AGENTS.mdAGENTS.md
- guides/AGENTS.mdAGENTS.md
- packages/agents/AGENTS.mdAGENTS.md
- packages/agents/src/tests/capabilities/AGENTS.mdAGENTS.md
- open-prSkill
- reproduceSkill
- debug-planSkill
- pirate-voiceSkill
- release-notesSkill
- test-planSkill
- workspace-digestSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
17 rules. About 0 are common, 9 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 62
Run from the repo root:
- Distinctive: line 77
Run an example locally:
- Very specific: line 109
Run pnpm run format to format all files
- Distinctive: line 114
Always TypeScript, always ES modules
- Very specific: line 116
All wrangler configs use compatibility_date: "2026-06-11" and compatibility_flags: ["nodejs_compat"]
- Very specific: line 117
Never hardcode secrets — use wrangler secret put or .env
- Distinctive: line 118
No native/FFI dependencies (must run in Workers runtime)
- Very specific: line 170
Keep Workspace as a pure durable filesystem — do not embed execution or session logic inside it.
- Distinctive: line 171
When a package boundary feels wrong (e.g., a helper package depending on a larger package just for an adapter), prefer moving the adapter …
- Very specific: line 177
Run pnpm run check before considering work done
- Very specific: line 178
Use import type for type-only imports (enforced by verbatimModuleSyntax)
- Distinctive: line 179
Keep examples simple and self-contained — they're user-facing learning material
- Distinctive: line 180
Use Cloudflare Workers APIs (KV, D1, R2, Durable Objects, etc.) over third-party equivalents
- Distinctive: line 181
Use Workers AI for LLM calls in examples — not third-party APIs like OpenAI or Anthropic
- Very specific: line 192
Add native/FFI/C-binding dependencies
- Very specific: line 193
Use any — Oxlint will reject it
- Distinctive: line 194
Use CommonJS or Service Worker format — ES modules only
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Project overview
Cloudflare Agents SDK — a framework for building stateful AI agents on Cloudflare Workers. This is a monorepo containing the core SDK packages, examples, guides, sites, and documentation.
Repository structure
packages/ # Published npm packages (need changesets for changes)
agents/ # Core SDK (see packages/agents/AGENTS.md)
ai-chat/ # @cloudflare/ai-chat — higher-level AI chat agent
hono-agents/ # Hono framework integration
codemode/ # @cloudflare/codemode — experimental code generation
examples/ # Self-contained demo apps (see examples/AGENTS.md)
playground/ # Main showcase app — all SDK features in one UI (uses Kumo design system)
mcp/ # MCP server example
mcp-client/ # MCP client example
... # ~20 examples total
experimental/ # Work-in-progress experiments (not published, no stability guarantees)
site/ # Deployed websites
agents/ # agents.cloudflare.com (Astro)
ai-playground/ # Workers AI playground (React + Vite)
guides/ # In-depth pattern tutorials with narrative READMEs (see guides/AGENTS.md)
anthropic-patterns/
human-in-the-loop/
openai-sdk/ # Examples using @openai/agents SDK
basic/ chess-app/ handoffs/ human-in-the-loop/ ...
docs/ # Markdown docs for developers.cloudflare.com (see docs/AGENTS.md)
design/ # Architecture and design decision records (see design/AGENTS.md)
scripts/ # Repo-wide tooling (typecheck, export checks, update checks)Nested AGENTS.md files
Some directories have their own AGENTS.md with deeper guidance:
| File | Scope |
packages/agents/AGENTS.md | Core SDK internals — exports, source layout, build, testing, architecture |
examples/AGENTS.md | Example conventions — required structure, consistency rules, known issues |
guides/AGENTS.md | Guide conventions — how guides differ from examples, README expectations |
docs/AGENTS.md | Writing user-facing docs — Diátaxis framework, upstream sync, style |
design/AGENTS.md | Design records and RFCs — format, workflow, relationship to docs |
Setup
pnpm install # installs all workspacesNode 24+ required. Uses pnpm workspaces with Nx for task orchestration, caching, and affected detection.
Commands
Run from the repo root:
| Command | What it does |
pnpm run build | Builds all packages via Nx (cached, dependency-ordered) |
pnpm run check | Full CI check: sherif + export checks + oxfmt + oxlint + typecheck |
pnpm run test | Runs all tests via Nx (cached) |
pnpm run test:react | Runs Playwright-based React hook tests for agents |
pnpm run typecheck | TypeScript type checking across the repo (custom script) |
pnpm run format | Oxfmt format all files |
pnpm run check:exports | Verifies package.json exports match actual build output |
pnpm exec nx affected -t build | Build only packages affected by current changes |
pnpm exec nx affected -t test | Test only packages affected by current changes |
pnpm exec nx run <project>:build | Build a single project (and its dependencies) |
Run an example locally:
cd examples/playground # or any example
pnpm dev # starts Vite dev server + Workers runtime via @cloudflare/vite-pluginExample apps will normally hot reload when the dev server is running. When the dev server is running, make sure to rebuild changed packages (pnpm run build) to see changes reflected in the running app.
Code standards
TypeScript
- Strict mode enabled (
agents/tsconfig) - Target: ES2021, module: ES2022, moduleResolution: bundler
verbatimModuleSyntax: true— use explicitimport typefor type-only imports- JSX:
react-jsx
Linting — Oxlint
Config in .oxlintrc.json. Plugins: react, jsx-a11y, typescript, react-hooks. Key rules:
no-explicit-any: "error"— never useany, useunknownand narrowno-unused-vars: "error"— withvarsIgnorePattern: "^_"andargsIgnorePattern: "^_"correctnesscategory set to"error"— catches common mistakesjsx-a11yrules enabled — accessibility violations are errorsreact-hooks/exhaustive-deps: "warn"— warns on missing hook dependencies
Oxlint does not handle formatting — Oxfmt does.
Formatting — Oxfmt
- Run
pnpm run formatto format all files - Config in
.oxfmtrc.json(trailingComma: "none",printWidth: 80)
Workers conventions
- Always TypeScript, always ES modules
wrangler.jsonc(not.toml) for configuration- All wrangler configs use
compatibility_date: "2026-06-11"andcompatibility_flags: ["nodejs_compat"] - Never hardcode secrets — use
wrangler secret putor.env - No native/FFI dependencies (must run in Workers runtime)
Testing
Tests use vitest with @cloudflare/vitest-pool-workers for running inside the Workers runtime.
pnpm run test # agents + ai-chat unit/integration tests
pnpm run test:react # Playwright-based React hook tests (agents package)Test locations:
packages/agents/src/tests/— core SDK testspackages/agents/src/react-tests/— React hook tests (Playwright + vitest-browser-react)packages/ai-chat/src/tests/— AI chat testspackages/agents/src/tests-d/— type-level tests (.test-d.ts)
Each test directory has its own vitest.config.ts and (for Workers tests) a wrangler.jsonc.
For a repo-wide rollup of what proves feature X works, at which layer, and which CI run guards it — plus the tracked skip/quarantine debt — see design/test-coverage-matrix.md.
Contributing
Changesets
Changes to packages/ that affect the public API or fix bugs need a changeset:
pnpm exec changeset # interactive prompt — pick packages, semver bump, descriptionThis creates a markdown file in .changeset/ that gets consumed during release.
Examples, guides, and sites don't need changesets.
Pull request process
CI runs on every PR (pnpm install --frozen-lockfile && pnpm run build && pnpm run check && pnpm exec nx affected -t test); the workflow is in .github/workflows/pullrequest.yml. On push to main the Release workflow (.github/workflows/release.yml) runs the same steps but uses nx run-many -t test as a safety net against under-reported affected projects, then publishes via changesets. All checks must pass.
Generated files
env.d.tsfiles are generated bywrangler types— regenerate withpnpm exec wrangler typesinside the relevant example/package, don't hand-editpnpm-lock.yaml— regenerated bypnpm install, don't hand-edit
Learned Workspace Facts
packages/shell/is published as@cloudflare/shell— an experimental sandboxed JS execution and filesystem runtime for agents, built on the same dynamic Worker loader machinery as@cloudflare/codemode.- To run code against a
Workspace: importstateToolsfrom@cloudflare/shell/workersandDynamicWorkerExecutor/resolveProviderfrom@cloudflare/codemode; useexecutor.execute(code, [resolveProvider(stateTools(workspace))]).
Learned User Preferences
- Keep
Workspaceas a pure durable filesystem — do not embed execution or session logic inside it. Execution is a caller concern wired via@cloudflare/codemode+stateTools. - When a package boundary feels wrong (e.g., a helper package depending on a larger package just for an adapter), prefer moving the adapter out rather than carrying the dependency.
Boundaries
Always:
- Run
pnpm run checkbefore considering work done - Use
import typefor type-only imports (enforced byverbatimModuleSyntax) - Keep examples simple and self-contained — they're user-facing learning material
- Use Cloudflare Workers APIs (KV, D1, R2, Durable Objects, etc.) over third-party equivalents
- Use Workers AI for LLM calls in examples — not third-party APIs like OpenAI or Anthropic
Ask first:
- Adding new dependencies to
packages/(these ship to users) - Changing
wrangler.jsonccompatibility dates across the repo - Modifying CI workflows
Never:
- Hardcode secrets or API keys
- Add native/FFI/C-binding dependencies
- Use
any— Oxlint will reject it - Use CommonJS or Service Worker format — ES modules only
- Modify
node_modules/ordist/directories - Force push to main
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

