create-reactive-agent
create-reactive-agent scaffolds a ready-to-run Reactive Agents project. One command — you get a typed TypeScript starter with the right provider wired up, an .env.example, a README, an AGENTS.md for coding agents, and a working start script.
Quickstart
Section titled “Quickstart”npm create reactive-agent my-agentbun create reactive-agent my-agentpnpm create reactive-agent my-agentThe CLI detects your package manager automatically. Running without a project name launches interactive prompts.
Interactive mode
Section titled “Interactive mode”┌ create-reactive-agent│◆ Project name?│ my-agent│◆ Template?│ ● minimal - single-file agent, no tools│ ○ with-tools - built-in tools and reasoning│ ○ streaming - token-by-token via agent.runStream()│ ○ with-structured-output - typed result.object via a schema│ ○ with-approval-gates - human-in-the-loop tool approval│ ○ with-memory - cross-session SQLite memory│ ○ cloudflare-worker - deployable edge Worker│◆ Provider?│ ● anthropic · openai · google · groq · xai · ollama│◆ Package manager?│ ● bun · npm · pnpm · yarn│└ Created 7 files in /path/to/my-agent
Next steps cd my-agent bun install cp .env.example .env # then set ANTHROPIC_API_KEY in .env bun start
• Docs: https://docs.reactiveagents.dev• Using a coding agent? AGENTS.md points it at the current docs and skills.Templates
Section titled “Templates”| Name | Description |
|---|---|
minimal |
Single-file agent. ReactiveAgents.create()...build() + agent.run(). Best starting point. |
with-tools |
Adds .withTools({ builtins: true }) (built-in: web-search, http-get, file I/O, code-execute) and .withReasoning({ defaultStrategy: "reactive" }). |
streaming |
Uses agent.runStream() to emit text-delta, tool-call, step-complete, completed, and error events. |
with-structured-output |
Adds a schema and returns a typed result.object. |
with-approval-gates |
Demonstrates human approval before a sensitive tool executes. |
with-memory |
Adds SQLite-backed memory across runs. |
cloudflare-worker |
OpenAI-backed, fetch-only Worker with Wrangler dev/deploy scripts and Worker secret bindings. |
Cloudflare Workers
Section titled “Cloudflare Workers”The cloudflare-worker template scaffolds an edge-ready Worker entry point, a wrangler.toml with the required nodejs_compat flag, a git-ignored .dev.vars secret stub, and dev/deploy scripts. It is pinned to OpenAI because that adapter is fetch-based and verified on the edge. Workers have no ambient process.env; the generated handler reads OPENAI_API_KEY from the Worker env binding. Persistent SQLite memory and shell/filesystem tools are intentionally omitted.
npm create reactive-agent my-edge-agent -- --template=cloudflare-worker --pm=bun --yescd my-edge-agentbun installbun run devFor production, add the secret with wrangler secret put OPENAI_API_KEY and run bun run deploy.
Minimal output
Section titled “Minimal output”import { ReactiveAgents } from "reactive-agents"
if (!process.env.ANTHROPIC_API_KEY) { console.error("ANTHROPIC_API_KEY is required") process.exit(1)}
const agent = await ReactiveAgents.create() .withName("my-agent") .withProvider("anthropic") .withModel("claude-sonnet-4-6") .withMaxIterations(10) .build()
const result = await agent.run("What is the capital of France?")console.log(result.output)Streaming output
Section titled “Streaming output”const stream = agent.runStream("Summarize the latest TypeScript release notes")
for await (const event of stream) { switch (event.type) { case "text-delta": process.stdout.write(event.delta) break case "tool-call": console.log(`\n[tool] ${event.toolName}`) break case "completed": console.log("\nDone.", event.output) break case "error": console.error("Error:", event.error) break }}Providers
Section titled “Providers”| Provider | Env var | Default model |
|---|---|---|
anthropic |
ANTHROPIC_API_KEY |
claude-sonnet-4-6 |
openai |
OPENAI_API_KEY |
gpt-4o-mini |
google |
GOOGLE_API_KEY |
gemini-2.5-flash |
groq |
GROQ_API_KEY |
openai/gpt-oss-120b |
xai |
XAI_API_KEY |
grok-4.7 |
ollama |
(none — local) | qwen3:4b |
Ollama runs locally with no API key. The scaffolded .env.example reflects the correct variable for the chosen provider. Run cp .env.example .env, then replace the your-key-here placeholder with your key. The generated project treats an unedited placeholder as a missing key: it prints one line and exits 1.
Non-interactive (CI)
Section titled “Non-interactive (CI)”npm create reactive-agent my-agent -- \ --template=streaming \ --provider=anthropic \ --pm=bun \ --yes--yes skips all prompts and accepts defaults. Combine with explicit flags for a fully deterministic scaffold.
| Flag | Description |
|---|---|
--template=<name> |
minimal | with-tools | streaming | with-structured-output | with-approval-gates | with-memory | cloudflare-worker |
--provider=<name> |
anthropic | openai | google | groq | xai | ollama |
--pm=<manager> |
bun | npm | pnpm | yarn |
--yes |
Skip prompts, accept defaults |
--help |
Show help |
--version |
Print version |
What gets scaffolded
Section titled “What gets scaffolded”my-agent/├── src/│ └── index.ts ← your agent (provider + model pre-wired)├── package.json ← reactive-agents dep, start + typecheck scripts├── tsconfig.json ← strict, Bundler module resolution├── .env.example ← provider API key hint├── .gitignore├── README.md└── AGENTS.md ← for coding agents (Claude Code, Cursor, Codex)AGENTS.md tells a coding agent to read the current docs instead of its training data: the llms.txt index, the .md version of any page, and npx skills add https://docs.reactiveagents.dev for the framework’s agent skills. It also lists the project’s real scripts, the builder rules, and (except for cloudflare-worker) how to explain a failed run with npx rax diagnose cause latest.
Stability
Section titled “Stability”create-reactive-agent is @stable as of v0.11. Template output is considered stable; the scaffold structure may gain new optional files in minor releases. See API Stability.
What’s Next
Section titled “What’s Next”Install
Bun (recommended)bun add reactive-agentsNode 22.5+npm install reactive-agentsGet notified on new releases