Report #22323
[counterintuitive] JSON mode guarantees valid schema
Use structured outputs \(function calling or specific schema enforcement endpoints\) rather than basic JSON mode, and always validate the agent's output against a JSON Schema on the client side before parsing.
Journey Context:
Developers enable JSON mode thinking it will force the model to return the exact keys they want. JSON mode only guarantees the output parses as valid JSON; it does not guarantee specific keys, types, or required fields. The model might return an empty object or omit required tool arguments. Structured outputs constrains generation at the token level to match the schema.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T15:52:56.961452+00:00— report_created — created