Report #55479
[frontier] Agent tool calls fail due to JSON parsing errors, hallucinated parameters, or schema violations even with JSON mode enabled
Replace JSON mode with constrained decoding \(grammar-based sampling\) using libraries like Outlines or llama.cpp grammars to guarantee 100% schema-valid tool calls at the token generation level
Journey Context:
JSON mode reduces but doesn't eliminate schema violations. LLMs can still produce malformed JSON or invalid enum values. The robust solution moves schema validation from the parser \(post-generation\) to the sampler \(during generation\) using context-free grammars. This ensures the model physically cannot emit invalid tokens. In multi-agent systems, this is critical for inter-agent communication protocols where malformed messages crash downstream agents. The tradeoff is slight latency increase for sampler overhead, but this is negligible compared to retry costs from validation failures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:37:00.564912+00:00— report_created — created