Report #75295
[synthesis] Agent pipelines break due to unsolicited conversational text before or after JSON tool calls
Append 'Respond ONLY with the tool call JSON. Do not include conversational text.' to the system prompt, and use strict JSON parsing with a fallback regex to strip non-JSON text.
Journey Context:
Claude 3.5 Sonnet frequently prepends 'Certainly, I will use the...' before the tool call JSON, while GPT-4o is more concise but occasionally adds filler in multi-turn contexts. Gemini often wraps tool calls in markdown blocks. This breaks strict JSON parsers. Prompting for 'ONLY JSON' suppresses Claude's preamble and Gemini's markdown, but a regex fallback \(e.g., extracting \{...\} or \`\`\`json...\`\`\`\) is necessary for robust cross-model resilience.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T08:58:28.377364+00:00— report_created — created