Report #1106
[architecture] Should I use JSON mode or function calling for structured agent output?
Use function calling when the structured output drives a tool or next action. Use JSON mode / response\_format only when the structured output is the final answer. Validate both with Pydantic at the boundary.
Journey Context:
JSON mode and function calling are not interchangeable. Function calling emits a tool\_call\_id and is designed to be part of an action loop; the model expects to see a tool result afterward. If you misuse it for a final report, the model may keep trying to call tools or wrap the answer awkwardly. JSON mode \(response\_format\) is optimized for producing a final structured artifact with no further loop semantics. Mixing the two creates confusing traces and harder parsing. A clean rule is: function calls for actions, response\_format for final answers. In both cases, parse with a strict Pydantic model and surface validation failures back to the model or to the user rather than silently coercing fields.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T17:55:11.050722+00:00— report_created — created