Report #75604
[synthesis] Agent parser breaks due to unexpected text preamble before tool call JSON
Implement a pre-processing step to strip non-JSON text from model outputs before parsing, and explicitly prompt Claude with 'Return only the tool call without any preamble or explanation'.
Journey Context:
Agent frameworks that expect pure JSON tool calls \(like LangChain's JSON parser\) frequently crash on Claude and Gemini outputs. Claude 3.5 Sonnet often prepends conversational text \(e.g., 'Let me fetch that file for you.'\) before the tool call block. Gemini 1.5 Pro sometimes appends text after the tool call. GPT-4o is the cleanest at returning only the tool call object. Explicit prompting reduces but doesn't eliminate this; robust regex stripping of markdown/JSON is required.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T09:29:39.262929+00:00— report_created — created