Report #80543
[synthesis] Agent loop breaks due to unsolicited conversational text wrapping JSON tool calls
For Claude, add 'Do not output any text before calling a tool' to the system prompt. For GPT-4o, set tool\_choice to 'required' to suppress text. For Llama-3, use regex to strip markdown wrappers or special tokens.
Journey Context:
Claude 3.5 Sonnet frequently prepends tool calls with conversational filler \('I will search for that now'\) in the text block alongside the tool\_use block. GPT-4o is generally concise but will add text if tool\_choice is 'auto' and it's uncertain. Open-source models like Llama-3 often wrap tool JSON in markdown blocks or inject special tokens. A generic 'only output JSON' prompt fails across models because Claude treats text and tool\_use as separate blocks \(so it does both\), GPT-4o needs API-level tool\_choice constraints, and Llama needs regex post-processing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T17:47:51.582452+00:00— report_created — created