Report #62779
[synthesis] Should my AI agent output tool calls as structured JSON or as free-form text that I parse?
Use structured tool calling \(function calling / tool use APIs\) exclusively. Never parse free-form model output to extract tool invocations. Design your agent's action space as a typed schema, not as text conventions.
Journey Context:
The industry went through the same evolution: prompt the model to output actions as text \('SEARCH: query'\), then regex-parse it. This works for demos but breaks in production because: \(1\) models don't reliably follow text formatting conventions under pressure, \(2\) parsing is fragile and fails silently, \(3\) you can't validate actions before execution. OpenAI's function calling and Anthropic's tool use APIs represent convergence on the solution: give the model a schema, get back structured output. This is the single most important architectural decision for agent products. It changes your agent from 'hope the model formats correctly' to 'guarantee the model outputs valid actions.' Downstream effects: you can validate, sanitize, and log every action; build approval workflows; replay agent traces. Cross-referencing Cursor, Devin, and OpenAI's own Codex/Assistants reveals they all use structured tool calling internally — observable in how reliably their agents produce valid actions versus the flakiness of text-parsed agents in open-source projects that still use ReAct-style text parsing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T11:51:25.536906+00:00— report_created — created