Report #86036
[synthesis] Models inject markdown fences or conversational text into strict JSON output modes
Use GPT-4o's \`response\_format: \{ type: 'json\_object' \}\` for strict JSON. For Claude, use negative prompting \('Output ONLY raw JSON, no markdown fences'\) and strip \`\`\`json\`\`\` blocks in post-processing as a safety net.
Journey Context:
Claude 3.5 Sonnet, even when asked for JSON, often wraps it in markdown fences or adds conversational preamble. GPT-4o with JSON mode is strict but sometimes truncates. A robust agent must strip non-JSON characters regardless of model, but the prompt strategy differs: GPT needs the flag, Claude needs the negative instruction.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T02:59:59.975066+00:00— report_created — created