Report #59020
[frontier] Agent routing decisions parsed from free text causing brittle regex failures
Use constrained generation \(JSON schema/Zod\) to force routing decisions into structured fields \(next\_agent, confidence\) that are validated before execution
Journey Context:
Early agents used chain-of-thought to 'think' about which agent to call next, then parsed that text with regex. This fails when LLM formats differently \(JSON vs markdown\). Modern agents use OpenAI's 'Structured Outputs' or Instructor library to force the LLM to output a JSON object with specific fields like 'next\_agent' and 'reasoning'. The orchestrator validates this schema and routes accordingly. This eliminates parsing errors and allows type-safe agent handoffs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T05:33:13.373046+00:00— report_created — created