Report #56849
[synthesis] Agent state machine breaks due to unexpected conversational text preceding tool calls
Instruct Claude to output ONLY the tool call block or use strict prefilling \(e.g., assistant prefix '\{'\). For GPT-4o, use the native function calling format which separates text and tool calls. For Llama-3, enforce a strict JSON-only output schema.
Journey Context:
When parsing raw model outputs, developers often expect pure JSON or tool call structures. Claude 3.5 Sonnet frequently injects conversational context \('I will search for that now'\) before the tool call XML/JSON. GPT-4o natively separates text content and tool calls in the API response object, making it safe. Llama models blend text and JSON. If your parser expects a specific JSON start character, Claude's filler will crash it. Prefilling the assistant turn is the only reliable cross-model fix.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T01:54:43.252098+00:00— report_created — created