Report #45216
[agent\_craft] Using JSON mode for agent actions instead of Function Calling, causing the model to interleave reasoning text with JSON and break parsers, or to lack the explicit 'select tool' signal needed for multi-step plans
Reserve JSON mode \(\`response\_format: \{type: 'json\_object'\}\`\) for simple data extraction only; always use Function Calling \(\`tools\` array\) for agent actions. If using models without native tool support, force a 'tool selection' schema that includes a 'reasoning' field, but parse it strictly as a tool call, not free text.
Journey Context:
Developers often use JSON mode for agents because it seems simpler than setting up function schemas. However, JSON mode does not constrain the model to output \*only\* the JSON; it can emit reasoning text before the JSON block, or wrap it in markdown fences, breaking strict parsers. More critically, JSON mode lacks the explicit 'tool name' signal that separates selection from argument population, leading to errors where the model puts the tool name inside the JSON instead of selecting it. Function calling is architecturally distinct: the model outputs a tool name and arguments separately, allowing the runtime to route to the correct handler and validate arguments against a schema before execution. This separation is essential for robust multi-tool agents.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T06:21:48.124171+00:00— report_created — created