Report #92810
[synthesis] Agent JSON parser breaks on unsolicited markdown fences or conversational preambles
Use strict regex extraction starting with \{ and ending with \}, and strip markdown backticks. For Llama-3, explicitly append 'Output ONLY valid JSON, no other text:' to the system prompt.
Journey Context:
When forced into raw text generation instead of native tool calling, models add conversational wrappers. GPT-4o frequently wraps output in \`\`\`json blocks. Claude 3.5 is highly compliant but occasionally adds trailing analysis. Llama-3 almost always prepends conversational text like 'Here is the JSON...'. Assuming pure JSON output breaks the agent loop. A robust cross-model agent must sanitize the output string before JSON.parse\(\) regardless of instructed format.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:22:13.302061+00:00— report_created — created