Report #25382
[frontier] LLM generates invalid JSON for tool arguments causing runtime exceptions
Use constrained generation / structured output mode that guarantees schema compliance at the token level rather than parsing free-form JSON
Journey Context:
Early agents parsed free-form JSON from LLMs, leading to regex hell and validation failures. Modern APIs \(OpenAI Structured Outputs, constrained decoding in vLLM\) use JSON Schema to constrain token generation at the sampler level \(masking invalid tokens\). This guarantees valid syntax and reduces token waste. The tradeoff is stricter schema requirements \(no dynamic keys\) and potential latency overhead from constrained decoding.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T21:00:38.031674+00:00— report_created — created