Examples Catalog
The repo includes a complete, tested example suite at apps/examples/. Every example exports a run() function, can be executed standalone with bun run, and runs in CI. The fastest way to learn this framework is to copy one of these and tweak it.
Directory at a glance
Section titled “Directory at a glance”Directoryapps/examples/
Directoryfoundations/ the minimum builder chain → memory → composition
- …
Directorytools/ built-in tools, MCP servers, dynamic registration
- …
Directoryreasoning/ strategies + model-adaptive context profiles
- …
Directorytrust/ identity, guardrails, verification
- …
Directorymulti-agent/ A2A protocol, orchestration, dynamic spawning
- …
Directorystreaming/ token streaming + SSE endpoints
- …
Directoryintegrations/ Next.js · Hono · Express adapters
- …
Directorygateway/ persistent autonomous agents
- …
Directorymessaging/ Signal + Telegram via MCP
- …
Directoryinteraction/ 5 autonomy modes
- …
Directoryadvanced/ cost · observability · self-improvement · eval
- …
- index.ts CLI runner —
bun run index.ts --filter <category> - README.md
Quick Start
Section titled “Quick Start”git clone https://github.com/tylerjrbuell/reactive-agents-tscd reactive-agents-ts/apps/examples
# Run all offline examples (no API key needed)bun run index.ts --offline
# Run a specific examplebun run src/foundations/01-simple-agent.ts
# Run all examples that match a categorybun run index.ts --filter foundationsFoundations
Section titled “Foundations”The shortest path from bun add reactive-agents to a working agent.
| # | Example | What it shows |
|---|---|---|
| 01 | simple-agent | The minimum builder chain — provider, build, run |
| 02 | lifecycle-hooks | Intercept any of the 12 phases with before / after / on-error |
| 03 | multi-turn-memory | agent.session() for conversational memory |
| 04 | agent-composition | Compose specialized agents into pipelines |
| 05 | agent-config | Agent-as-data: serialize → JSON → reconstruct |
| 06 | composition | pipe(), parallel(), race() functional combinators |
Built-in tools, MCP servers, and runtime tool registration.
| # | Example | What it shows |
|---|---|---|
| 05 | builtin-tools | web-search, file-read, code-execute, etc. |
| 06 | mcp-filesystem | MCP filesystem server via .withMCP() |
| 07 | mcp-github | MCP GitHub server |
| — | dynamic-registration | agent.registerTool() / unregisterTool() at runtime |
Reasoning
Section titled “Reasoning”The 5 strategies and model-adaptive context profiles.
| # | Example | What it shows |
|---|---|---|
| 19 | reasoning-strategies | ReAct, Reflexion, Plan-Execute, Tree-of-Thought, Adaptive |
| 20 | context-profiles | Local / mid / large / frontier tier tuning |
Trust & Safety
Section titled “Trust & Safety”Identity, guardrails, and verification.
| # | Example | What it shows |
|---|---|---|
| 11 | identity | Ed25519 certificates, RBAC, delegation |
| 12 | guardrails | Pre-LLM injection, PII, toxicity blocking |
| 13 | verification | Semantic entropy, fact decomposition, NLI |
Multi-Agent
Section titled “Multi-Agent”A2A protocol, orchestration, and dynamic sub-agent spawning.
| # | Example | What it shows |
|---|---|---|
| 08 | a2a-protocol | Agent Cards, JSON-RPC server/client, SSE |
| 09 | orchestration | Sequential / parallel / pipeline / map-reduce workflows |
| 10 | dynamic-spawning | .withDynamicSubAgents() — model-driven delegation |
Streaming
Section titled “Streaming”Token streaming, SSE endpoints, and abort signals.
| # | Example | What it shows |
|---|---|---|
| 23 | token-streaming | agent.runStream() AsyncGenerator with IterationProgress events |
| 24 | streaming-sse-server | One-line AgentStream.toSSE() HTTP endpoint |
Web Framework Integrations
Section titled “Web Framework Integrations”Drop-in adapters for popular Node/Bun servers.
| # | Example | What it shows |
|---|---|---|
| 25 | nextjs-streaming | Next.js Route Handler with useAgentStream |
| 26 | hono-agent-api | Hono on Bun with SSE streaming |
| 27 | express-middleware | Express middleware pattern |
Gateway
Section titled “Gateway”Persistent autonomous agents with heartbeats, crons, and webhooks.
| # | Example | What it shows |
|---|---|---|
| 22 | persistent-gateway | Adaptive heartbeat + cron scheduling + webhook ingestion |
| 25 | hn-gateway-monitor | Real-world monitor: 24/7 Hacker News watcher with policy budgets |
| 26 | gateway-chat-mode | Per-sender SQLite session history + episodic context injection |
Messaging
Section titled “Messaging”Connect agents to Signal and Telegram via MCP.
| Example | What it shows |
|---|---|
| signal-telegram-hub | Multi-channel message hub bridging Signal + Telegram + the agent |
Interaction
Section titled “Interaction”Autonomy modes and approval gates.
| # | Example | What it shows |
|---|---|---|
| 21 | interaction-modes | Autonomous · Supervised · Collaborative · Consultative · Interrogative |
Advanced
Section titled “Advanced”Cost tracking, observability, self-improvement, evaluation.
| # | Example | What it shows |
|---|---|---|
| 14 | cost-tracking | Complexity routing + budget enforcement + dynamic pricing |
| 15 | prompt-experiments | A/B testing prompts via the prompt library |
| 16 | eval-framework | LLM-as-judge scoring with frozen-judge isolation |
| 17 | observability | Distributed tracing + metrics dashboard + structured logging |
| 18 | self-improvement | Cross-task strategy outcome learning |
| 20 | compose-harness | Composable harness pipeline |
Running Patterns
Section titled “Running Patterns”# Offline only (test provider — no API keys needed)bun run index.ts --offline
# Filter by categorybun run index.ts --filter reasoning
# Single file, standalonebun run src/foundations/01-simple-agent.ts
# All examples (requires ANTHROPIC_API_KEY etc. in .env)bun run index.tsEvery example is exercised by the test runner on every PR — if it’s listed here, it works.
Next steps
Section titled “Next steps”- Quickstart — set up your own project from scratch
- Common Builder Stacks — copy-paste chains organized by use case
- Choosing a Stack — match provider · model · memory to your workload