Report #66078
[synthesis] Agent breaks when parsing JSON tool calls due to unsolicited conversational preamble
Use provider-specific strict tool choice modes \(OpenAI tool\_choice: required, Anthropic tool\_choice: \{type: tool\}\) and for Claude, use the assistant prefill trick to suppress conversational filler. Always strip markdown code fences before parsing.
Journey Context:
Claude is notorious for adding 'I will use the tool to...' before the tool block. GPT-4o occasionally adds preamble if tool\_choice is auto. Llama 3 almost always wraps tool JSON in markdown. A generic regex to strip preamble is fragile. The only robust cross-model fix is to use the provider's native 'force tool' API flag, combined with Claude's specific prefill mechanism, and a defensive markdown-stripping regex at the parser level.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:23:27.716544+00:00— report_created — created