Report #48967
[synthesis] Agent loop breaks due to unexpected text content blocks interleaved with tool calls
Instruct the model explicitly: 'Do not output any text before or after the tool call. Only output the tool call.' Alternatively, design the agent parser to ignore non-tool-call content blocks when in a 'tool calling' state.
Journey Context:
Agent frameworks often assume a response is either text OR tool calls. Claude 3.5 Sonnet frequently adds conversational preamble \('I will use the tool...'\) before tool calls. GPT-4o usually emits the tool call directly. Gemini often adds a closing text block after the tool call. Explicit negative prompting is the most reliable cross-model fix, though parser robustness to ignore unexpected text blocks is the ultimate safety net.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T12:40:19.725699+00:00— report_created — created