Combobulating

ADR-0008 — Orchestrator: Deterministic LangGraph State Machine over Free-Form Chat

Status

Accepted (2026-05-07). Source: plan.md §13; technical_spec.md §4.1.

Context

The orchestrator coordinates four agents and emits actions to the Experience Layer. Two designs exist for this kind of system:

  1. A deterministic state machine with named states, guarded transitions, explicit timeouts, and typed inputs and outputs.
  2. A free-form chat loop where the orchestrator LLM “talks to” agent LLMs in natural language until consensus is reached.

The free-form chat design is on display in early multi-agent frameworks (e.g. AutoGen, https://arxiv.org/abs/2308.08155). It is flexible but introduces infinite-loop risk, observability gaps, hallucinated tool calls, and uneven latency.

Constraints:

Decision

The orchestrator is implemented as a LangGraph state machine (https://langchain-ai.github.io/langgraph/) with seven states:

Idle → Listening → Deliberating → AwaitingConfirm | Executing → LoggingTrace → Cooldown → Idle

Each state has a typed entry action, a typed exit guard, and an explicit timeout (technical_spec.md §4.1). On timeout the machine takes a defined transition rather than an undefined behaviour:

The orchestrator LLM (Phi-3-mini, ADR-0002) does not drive the state machine. It is invoked from inside specific states (Deliberating for novel candidate sets, LoggingTrace for LLM-sourced rationale) with bounded prompts and bounded output token counts.

Inter-agent communication is via typed JSON tool calls (ADR-0009), not chat. The orchestrator exposes each agent’s tool catalogue and dispatches calls programmatically.

Consequences

Positive:

Negative / costs:

Alternatives

End of ADR-0008.