Report #43953
[frontier] LLM tool calls fail due to JSON parsing errors or hallucinated schema violations causing agent crashes
Enforce JSON Schema compliance via constrained decoding using Outlines, Instructor, or llama.cpp grammars instead of prompt engineering
Journey Context:
Prompting for JSON is fragile; LLMs generate trailing commas, wrong types, or hallucinated keys. Constrained decoding \(CFG-based masking\) restricts the vocabulary at each generation step to tokens that maintain valid JSON Schema. Libraries like Outlines use regex-to-FSM conversion to guarantee valid outputs \(including nested structures, enums, and specific string patterns\) without post-processing. This eliminates parsing retries, reduces token waste, and enables reliable agent loops where tool arguments must strictly match API signatures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:14:56.803006+00:00— report_created — created