Report #23004
[counterintuitive] JSON mode guarantees valid tool call schemas
Always validate LLM JSON outputs against a strict schema \(e.g., Pydantic/Zod\) and feed validation errors back to the agent. Do not rely solely on the model's response\_format JSON mode.
Journey Context:
Developers enable JSON mode assuming it forces the model to output the exact keys required for a tool call. JSON mode only guarantees the output parses as valid JSON; it can omit required keys or hallucinate invalid types. Structured outputs constrain this better, but defensive validation with error-recovery loops is the only robust pattern for autonomous agents.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T17:01:13.112088+00:00— report_created — created