Skip to content

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.

  • 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
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 all examples that match a category
bun run index.ts --filter foundations

The shortest path from bun add reactive-agents to a working agent.

#ExampleWhat it shows
01simple-agentThe minimum builder chain — provider, build, run
02lifecycle-hooksIntercept any of the 12 phases with before / after / on-error
03multi-turn-memoryagent.session() for conversational memory
04agent-compositionCompose specialized agents into pipelines
05agent-configAgent-as-data: serialize → JSON → reconstruct
06compositionpipe(), parallel(), race() functional combinators

Built-in tools, MCP servers, and runtime tool registration.

#ExampleWhat it shows
05builtin-toolsweb-search, file-read, code-execute, etc.
06mcp-filesystemMCP filesystem server via .withMCP()
07mcp-githubMCP GitHub server
dynamic-registrationagent.registerTool() / unregisterTool() at runtime

The 5 strategies and model-adaptive context profiles.

#ExampleWhat it shows
19reasoning-strategiesReAct, Reflexion, Plan-Execute, Tree-of-Thought, Adaptive
20context-profilesLocal / mid / large / frontier tier tuning

Identity, guardrails, and verification.

#ExampleWhat it shows
11identityEd25519 certificates, RBAC, delegation
12guardrailsPre-LLM injection, PII, toxicity blocking
13verificationSemantic entropy, fact decomposition, NLI

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

#ExampleWhat it shows
08a2a-protocolAgent Cards, JSON-RPC server/client, SSE
09orchestrationSequential / parallel / pipeline / map-reduce workflows
10dynamic-spawning.withDynamicSubAgents() — model-driven delegation

Token streaming, SSE endpoints, and abort signals.

#ExampleWhat it shows
23token-streamingagent.runStream() AsyncGenerator with IterationProgress events
24streaming-sse-serverOne-line AgentStream.toSSE() HTTP endpoint

Drop-in adapters for popular Node/Bun servers.

#ExampleWhat it shows
25nextjs-streamingNext.js Route Handler with useAgentStream
26hono-agent-apiHono on Bun with SSE streaming
27express-middlewareExpress middleware pattern

Persistent autonomous agents with heartbeats, crons, and webhooks.

#ExampleWhat it shows
22persistent-gatewayAdaptive heartbeat + cron scheduling + webhook ingestion
25hn-gateway-monitorReal-world monitor: 24/7 Hacker News watcher with policy budgets
26gateway-chat-modePer-sender SQLite session history + episodic context injection

Connect agents to Signal and Telegram via MCP.

ExampleWhat it shows
signal-telegram-hubMulti-channel message hub bridging Signal + Telegram + the agent

Autonomy modes and approval gates.

#ExampleWhat it shows
21interaction-modesAutonomous · Supervised · Collaborative · Consultative · Interrogative

Cost tracking, observability, self-improvement, evaluation.

#ExampleWhat it shows
14cost-trackingComplexity routing + budget enforcement + dynamic pricing
15prompt-experimentsA/B testing prompts via the prompt library
16eval-frameworkLLM-as-judge scoring with frozen-judge isolation
17observabilityDistributed tracing + metrics dashboard + structured logging
18self-improvementCross-task strategy outcome learning
20compose-harnessComposable harness pipeline

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
# 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.