AI Lab · LangGraph
LangGraph Multi-Agent Orchestration
A reference build exploring how supervisor and specialist agents, expressed as an explicit LangGraph state machine, can execute enterprise workflows with policy checkpoints and full replayability.
Hypothesis
Expressing governance controls as first-class graph nodes — rather than wrapping agents in external guardrails — produces multi-agent systems that are both more autonomous and more auditable, because every policy decision becomes a typed, replayable state transition.
Stack
Architecture summary
A supervisor node routes work to specialist agents (research, analysis, drafting, action). Shared state is a typed Pydantic model persisted by a Postgres checkpointer after every step. Policy nodes evaluate risk tier and route T3/T4 actions through an interrupt for human approval. All transitions emit OpenTelemetry spans correlated by thread ID.
Research questions
- RQ1
Where should policy evaluation live — in a dedicated node, in conditional edges, or inside each tool?
- RQ2
How much supervisor reasoning is needed before routing becomes a deterministic function of state?
- RQ3
What is the operational cost of human-in-the-loop interrupts at enterprise volumes?
- RQ4
Can graph checkpoints serve as audit evidence without a separate logging pipeline?
Lab notebook
Why graphs, not chains
Linear chains hide control flow inside prompts. When a chain misbehaves, the only artefact is a transcript. A graph makes control flow explicit: nodes are units of work, edges are decisions, and state is a typed object you can inspect at every step. That property — inspectable control flow — is what enterprise governance needs.
Reference topology
┌──────────────┐
input ───▶ │ supervisor │ ◀──────────────┐
└──────┬───────┘ │
┌───────────┼───────────┬────────────┤
▼ ▼ ▼ │
research analysis drafting │
└───────────┴─────┬─────┘ │
▼ │
┌─────────────┐ approved │
│ policy gate │ ──────────┤
└──────┬──────┘ │
T3/T4 ▼ │
┌─────────────┐ │
│ human review│ ──────────┘
└─────────────┘
The policy gate is an ordinary node. It reads the proposed action from state, evaluates it against the risk-tier control matrix, and either passes it through or raises an interrupt. Because it is a node, its decision is checkpointed like any other step.
Typed state
class WorkflowState(BaseModel):
request: Request
plan: list[Step] = []
findings: list[Finding] = []
proposed_action: Action | None = None
risk_tier: Literal["T1", "T2", "T3", "T4"] | None = None
approvals: list[Approval] = []
Typed state turns prompt-engineering failures into validation errors. A specialist that returns a malformed finding fails loudly at the boundary instead of silently corrupting downstream reasoning.
Early findings
- Deterministic routing wins. After the first planning step, more than 80% of supervisor routing decisions could be expressed as pure functions of state. LLM routing is reserved for genuinely ambiguous branches.
- Interrupts are cheap; context is not. Human approval latency matters less than the cost of re-hydrating context for the reviewer. A structured approval card generated from state reduced review time materially in trials.
- Checkpoints are almost audit evidence. With a stable schema and retention policy, the checkpoint table answers most "why did the agent do that?" questions. Gaps remain around tool-side effects, which still need their own logging.
Next experiments
- Compare policy-in-node vs policy-in-edge for latency and clarity.
- Introduce per-tool MCP scopes and measure how often the policy gate becomes redundant.
- Load-test the Postgres checkpointer at 10k concurrent threads.