Skip to content
Star33Playground

Examples Catalog

Last updated 2026-11-17 · 71af36722

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.

  • 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
      • …
    • Directorydemos/ standalone showcase apps (not part of the numbered/CI catalog)
      • …
    • index.ts CLI runner — bun run index.ts --filter <category>
    • README.md
Terminal window
git clone https://github.com/tylerjrbuell/reactive-agents-ts
cd reactive-agents-ts/apps/examples
# Run all offline examples (no API key needed)
bun run index.ts --offline
# Run a specific example
bun run src/foundations/01-simple-agent.ts
# Run or list a standalone demo through Rax
rax examples list
rax examples demo island-sim --provider ollama --model cogito:14b --port 3007
# Run all examples that match a category
bun run index.ts --filter 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
— mcp-oauth OAuth 2.1 client_credentials against a remote MCP server via .withMCP({auth})
— dynamic-registration agent.registerTool() / unregisterTool() at runtime

The reasoning 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

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

A2A protocol, orchestration, and dynamic sub-agent spawning.

# Example What it shows
08 a2a-protocol Agent Cards, JSON-RPC server/client, SSE
10 dynamic-spawning .withDynamicSubAgents() — model-driven delegation

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

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

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

Connect agents to Signal and Telegram via MCP.

Example What it shows
signal-telegram-hub Multi-channel message hub bridging Signal + Telegram + the agent

Autonomy modes and approval gates.

# Example What it shows
21 interaction-modes Autonomous · Supervised · Collaborative · Consultative · Interrogative

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
22 durable-hitl Durable approval gates — run() pause → approveRun/denyRun + onApproval

Standalone showcase apps under apps/examples/src/demos/ are not part of the numbered index.ts catalog above (they have no run() export). Each has its own usage notes and focused tests where provided.

Example What it shows
halopedia-agent Full-featured interactive research agent: 7 custom domain tools (search, page/section/table fetch, cross-entity compare, link-graph explore), persistent cross-session memory (.withMemory() + find/recall/relate meta-tools), .withToolIntent() for domain-tuned chat routing, agent.session({ onOverflow }) for summarize-on-overflow history compaction, and verifyCitations: true to catch uncited/fabricated sources — run bun run apps/examples/src/demos/halopedia-agent.ts for a live Halo-lore REPL (requires Ollama)
local-vs-frontier Same builder chain run twice — a local 4B model and a frontier model complete the same tool-using task, only the provider/model line changes (see demos/README.md for GIF recording)
canonical-chat-session Reference agent.session() conversational loop
durable-resume Crash-resume via .withDurableRuns() outside the eval-scoped 22-durable-hitl example
island-survival Deterministic survival simulation with optional local world generation and camp-batched System One decisions; provider failures fall back to scripted moves

Terminal window
# Offline only (test provider — no API keys needed)
bun run index.ts --offline
# Filter by category
bun run index.ts --filter reasoning
# Single file, standalone
bun run src/foundations/01-simple-agent.ts
# List or launch a standalone demo
rax examples list
rax examples demo island-sim --provider ollama --model cogito:14b --port 3007
# All examples (requires ANTHROPIC_API_KEY etc. in .env)
bun run index.ts

Every example is exercised by the test runner on every PR — if it’s listed here, it works.

Install

Bun (recommended)bun add reactive-agents
Node 22.5+npm install reactive-agents

Get notified on new releases