ADR-0051: The Agentic Voice Orchestrator is the Only Voice Path
The master record is kept in the project's private repository. Date: 2026-05-07 Status: Accepted Deciders: the project author (implementation AI-assisted) Supersedes: ADR-0049 (Thin Voice Architecture) Relates to: clarifying-questions decisions, ADR-0050 (Twilio + self-hosted LiveKit SIP; master record private), and the agentic orchestrator design specification (private repository).
Context
The voice channel carried two orchestrators since 2026-05-06:
- The thin voice orchestrator (ADR-0049, 2026-04-30) — deterministic pipeline: regex pre-filter → FAQ → RAG. Predictable, fast in the happy path, but brittle on anything outside its hand-coded routing tables.
- The agentic voice orchestrator (greenfield 2026-05-06) — agentic GPT-4.1 with tool use: search the hospital knowledge base, transfer to the helpdesk, switch language, end the call. Routing decisions made by the LLM on the actual user utterance.
Routing was gated on a feature flag (default off), intended as an A/B comparison. In practice, two issues emerged:
- Drift between the two paths. The thin orchestrator and the agentic orchestrator each accumulated their own copies of helpers (language resolution lived in both files), prompt fragments, and answer-shaping rules. Bug fixes had to be applied twice or the wrong path silently regressed.
- Pilot 2026-05-07 transcript surfaced rigidity that an LLM router handles natively. A caller said "Do you speak English?" in English. Deepgram (Dutch-locked) phonetically mapped this to "Duursteking licht spelen" — gibberish. The thin pipeline's deterministic routing has no concept of "this transcript is nonsense — escalate or switch language"; it routed the gibberish to RAG, which produced the dead-end "Ik kon deze informatie niet terugvinden" answer 45 seconds later. The caller hung up. The agentic orchestrator's tool-calling gives the LLM the same option we'd want a human dispatcher to have ("garbage input → transfer to the helpdesk") without us hand-coding every input shape.
Decision
The voice channel uses the agentic orchestrator exclusively. The deterministic thin pipeline is deleted from the codebase (the thin orchestrator module, its integration end-to-end suite and the unit tests of its internal methods).
Four shared helper functions (compound-query detection, list-all detection, specificity-hint detection and bare-affirmation detection) move into the existing voice pre-filter module because both the RAG service and the agentic orchestrator use them. The module keeps its current name as a follow-up cleanup item; the "thin" prefix is now misleading but renaming is a wide import edit that doesn't carry weight on its own.
The feature flag is downgraded to a no-op kept only so existing environment configurations don't trip the settings validator, which rejects unknown keys. It will be removed in a follow-up cleanup.
Consequences
Positive
- Single source of truth for voice behavior. One orchestrator, one prompt, one tool table. Bug fixes apply once.
- LLM-driven recovery on bad input. Gibberish, code-switched speech, and language requests now route through the same decision layer that handles substantive queries.
- Cleaner ops surface. The enable/disable knob no longer exists in any meaningful sense — there is no "fall back to thin" reflex during a deploy mishap.
- ~7 000 lines deleted (orchestrator + E2E suite + duplicated unit tests).
Negative / Risks
- Cost floor rises. Every voice turn now invokes GPT-4.1; the thin pipeline could short-circuit greetings/farewells/FAQ matches without an LLM call. Mitigation: the regex pre-filter still runs before the LLM and short-circuits greeting/farewell/handoff/safety classes. The LLM only fires when the pre-filter returns FALLTHROUGH — the same gate the agentic orchestrator already used.
- No fallback if GPT-4.1 endpoint is down. Mitigation: existing failure path (the orchestrator returns an "escalate" result on any tool or LLM exception and the voice agent transfers the call to a human).
- Iteration loops on poor input. Observed in the pilot transcript: the LLM searched the knowledge base 7 times on gibberish before giving up. Mitigation: a three-iteration cap and empty-result early-exit land in the same batch as this ADR (separate commits for review granularity).
Implementation summary
The thin orchestrator, its unit tests and its end-to-end integration suite were deleted. The four shared helpers were absorbed into the voice pre-filter module. The two routing branches (the query endpoint and the public chat connection) were collapsed into a single call to the agentic orchestrator. The feature flag was marked deprecated and its default flipped to on; the example configuration and one prompt docstring were updated to reference this ADR.
Follow-ups
- Rename the voice pre-filter module to a channel-agnostic name. Mechanical edit; deferred to keep the change reviewable.
- Remove the deprecated flag once enough deploy cycles confirm no configuration still references it.
- Add an evaluation harness for voice (recorded calls + LLM-as-judge scoring per turn). The agentic system gives us more axes of failure than the thin one — without eval coverage, regressions surface only via live calls.
References
- ADR-0049 (superseded): the deterministic thin pipeline this ADR replaces.
- ADR-0050 (master record private): Twilio + self-hosted LiveKit SIP — the runtime that hosts this orchestrator.
- LiveKit Agents documentation — framework reference.
- Pydantic AI documentation — structured-output pattern used by the orchestrator's tool dispatch.