An SDK for building stateful AI agents on Cloudflare Workers.
On this page
Overview
Cloudflare Agents gives packages, examples, tutorials, and design records their own local instructions. The root guide explains the split between runtime and browser tests, generated bindings, and public package releases.
The nested-guide table separates SDK internals from examples, narrative tutorials, user documentation, and design records. The routing carries writing and consistency expectations as well as code conventions.
Source excerpt starting at line 42.
42Some directories have their own AGENTS.md with deeper guidance:
02 / Verification by change type
Distinguish runtime tests from browser hook tests
Workers tests run in the Workers pool, while React hooks use a separate Playwright-based command and directory. The guide also points to a coverage matrix that maps features to layers and CI evidence.
Source excerpt starting at line 125.
125pnpm run test # agents + ai-chat unit/integration tests126pnpm run test:react # Playwright-based React hook tests (agents package)
03 / Generated file guards
Name the generator for environment types
Environment declaration files must be regenerated inside the relevant package or example. The command and working directory matter because bindings are scoped to that configuration.
Source excerpt starting at line 160.
160- `env.d.ts` files are generated by `wrangler types` — regenerate with `pnpm exec wrangler types` inside the relevant example/package, don't hand-edit
04 / Contribution etiquette
Keep published behavior distinct from learning material
Public API and bug-fix changes in packages need changesets. Examples, guides, and sites do not, so the rule follows what is released to package consumers.
Source excerpt starting at line 152.
152Examples, guides, and sites don't need changesets.
Ideas for your repo
01Route documentation and examples by their purpose, not just their file type.
02State which tests exercise the actual runtime and which require a browser.
03Put the generator and working directory beside generated-file restrictions.
04Base release-note requirements on the published surface.
Sponsored by
Give your agents the whole story.
These instructions explain how to work in Cloudflare Agents. Modem shows your agents what customers said, who is affected, and what changed.