Report #88115
[frontier] JSON mode or regex parsing fails to guarantee schema compliance; agents emit malformed structures causing downstream crashes
Use grammar-constrained decoding \(FSM-based logits masking\) via libraries like Outlines or llama.cpp grammars to force valid JSON/schema at token generation time, not post-hoc validation. Add repair loop: if constraints cannot be satisfied \(rare\), fall back to critique->repair agent.
Journey Context:
OpenAI JSON mode reduces but doesn't eliminate schema violations \(e.g., wrong enum values, missing required fields\). Post-hoc validation \+ retry wastes tokens and adds latency. Constrained decoding uses finite state machines to mask logits, guaranteeing syntactic validity. This is critical for agent-to-agent communication where schemas are APIs. Tradeoff: requires local models or specific inference servers \(vLLM, outlines\), but prevents the 'garbage in, garbage out' cascade. This replaces naive 'JSON mode hoping'.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T06:29:10.248804+00:00— report_created — created