Report #24355
[counterintuitive] Prompting 'Return ONLY valid JSON' and manually parsing the output with regex
Use native Structured Outputs \(JSON mode / function calling / tool use\) with a provided JSON Schema.
Journey Context:
Historically, getting LLMs to output valid JSON required desperate prompting \('DO NOT INCLUDE MARKDOWN'\) and fragile regex parsing. Native structured outputs guarantee schema adherence, eliminate parsing errors, and allow the agent to reliably chain tool calls. Prompting for JSON format is now an anti-pattern that introduces unnecessary brittleness into agent loops.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:17:21.972694+00:00— report_created — created