Skip to content

Architecture

Reactive Agents uses a layered, composable architecture built on Effect-TS.

┌─────────────────────────┐
│ ReactiveAgentBuilder │ Public API
└────────────┬────────────┘
┌────────────▼────────────┐
│ ExecutionEngine │ 10-phase lifecycle
└────────────┬────────────┘
┌───────────────────────┼───────────────────────┐
│ │ │
┌────▼────┐ ┌─────▼─────┐ ┌─────▼─────┐
│ Memory │ │ Reasoning │ │ Tools │
│ (L2) │ │ (L3) │ │ (L8) │
└────┬────┘ └─────┬─────┘ └─────┬─────┘
│ │ │
┌────▼────────────────────────▼───────────────────────▼────┐
│ LLM Provider (L1.5) │
└────────────────────────────┬─────────────────────────────┘
┌────────────────────────────▼─────────────────────────────┐
│ Core Services (L1) │
│ EventBus · AgentService · TaskService │
└──────────────────────────────────────────────────────────┘

These can be enabled independently:

LayerPackageWhat It Does
Guardrails@reactive-agents/guardrailsInput/output safety
Verification@reactive-agents/verificationFact-checking, semantic entropy
Cost@reactive-agents/costModel routing, budget enforcement
Identity@reactive-agents/identityAgent certificates, RBAC
Observability@reactive-agents/observabilityTracing, metrics, logging
Interaction@reactive-agents/interaction5 autonomy modes
Orchestration@reactive-agents/orchestrationMulti-agent workflows
Prompts@reactive-agents/promptsTemplate engine
A2A@reactive-agents/a2aAgent-to-Agent protocol (JSON-RPC, Agent Cards, SSE)
Core ← LLM Provider ← Memory
← Reasoning
← Tools
Core ← Guardrails (standalone)
← Verification (standalone)
← Cost (standalone)
← Identity (standalone)
← Observability (standalone)
← Interaction (needs EventBus)
← Orchestration (standalone)
← Prompts (standalone)
← A2A (needs Core + Tools)

Every layer is an Effect Layer — a recipe for building a service. Layers compose through Layer.merge and Layer.provide:

import { createRuntime } from "@reactive-agents/runtime";
// The runtime composes all enabled layers into a single Layer
const runtime = createRuntime({
agentId: "my-agent",
provider: "anthropic",
enableGuardrails: true,
enableReasoning: true,
enableCostTracking: true,
});
// This Layer provides ALL services needed by the ExecutionEngine

This means:

  • No singletons — Each agent gets its own service instances
  • No global state — Everything is scoped to the Layer
  • Testable — Swap any layer with a test implementation
  • Tree-shakeable — Disabled layers aren’t loaded