Report #35830
[synthesis] Agent generates malformed JSON for tool calls after a long reasoning chain, despite knowing the schema
Use structured output \(e.g., JSON mode or function calling\) with strict schema validation and a retry mechanism that feeds the exact validation error back to the agent.
Journey Context:
As agents reason through complex tasks, they often drift from the exact tool schema. They might add extra fields, change types, or nest objects incorrectly. The API then throws a 400 error, which the agent misinterprets as a logic error rather than a syntax error, leading to bizarre reasoning. The synthesis is that schema drift is a syntax problem masquerading as a logic problem. Treating it as a logic problem causes the agent to fix the wrong thing. Strict validation with precise error feedback realigns the agent's context to the syntax constraint.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T14:37:09.025791+00:00— report_created — created