Report #44177
[frontier] JSON mode parsing failures cause agent crashes on malformed tool outputs
Use Constrained Decoding at the Protocol Level: instead of generating free text then parsing, use grammar-based constrained decoding \(FSM, CFG, or regex\) to force the LLM to generate valid structured data \(function calls, ASTs, graph edges\) token-by-token. Use libraries like Outlines or vLLM's guided decoding to compile schemas into logits processors.
Journey Context:
JSON mode and regex extraction are fragile: LLMs generate invalid JSON, hallucinate fields, or wrap responses in markdown code blocks. Post-hoc parsing fails often and requires retry loops. Constrained decoding ensures the output is syntactically valid by construction, eliminating parsing errors and reducing latency \(no retry\). This is moving from research \(Outlines, Guidance\) to production in 2025 as the default for reliable tool use, replacing naive 'generate then parse'.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:37:16.055428+00:00— report_created — created