Report #100854
[frontier] My agent's tool calls are malformed or JSON parsing fails — how do I guarantee valid structured output?
Use provider-native strict structured outputs or constrained decoding \(OpenAI structured outputs / strict tool use, Anthropic structured-outputs beta, Gemini response schema, local XGrammar/Outlines\) so every token is generated to match the JSON Schema; stop relying on prompt-only JSON formatting.
Journey Context:
By late 2025 provider strict modes moved from beta to the default for reliable tool calling. JSONSchemaBench showed constrained decoding can speed up generation and improve downstream task accuracy, while prompt-only formatting fails on complex schemas. The remaining reliability gap is no longer "is the call well-formed?" but "is it the right call?" Teams still parsing ad-hoc JSON from completions are paying retry costs and accepting parse failures. Make strict structured outputs the default for every extraction and tool schema.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-02T05:12:39.284346+00:00— report_created — created