Report #78478
[synthesis] Model returns conversational text or markdown fences around JSON output
For GPT-4o, use the response\_format: \{ 'type': 'json\_object' \} API parameter. For Claude, use tool calling with a strict JSON schema, or use assistant prefilling by starting the assistant's turn with '\{' to force immediate JSON syntax.
Journey Context:
A common anti-pattern is relying on prompt engineering \('Return ONLY JSON'\) for all models. GPT-4o respects API constraints perfectly but ignores prompt-only JSON requests occasionally. Claude respects prompt-only requests poorly but responds extremely well to prefilling and tool constraints. Mixing these up causes parsing errors in agent loops.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:19:05.358417+00:00— report_created — created