Report #20911
[synthesis] Identical agent loop fails when switching from GPT-4o to Claude — tool call response format differs
Implement provider-specific response parsers: OpenAI returns tool calls as message.tool\_calls\[\].function.\{name,arguments\}, while Anthropic returns content\[\] blocks with type:'tool\_use' containing id, name, and input. Abstract behind a provider adapter — never assume a unified format.
Journey Context:
A common mistake is building an agent loop around OpenAI's tool\_calls array and then attempting to swap to Claude by only changing the API endpoint. The structural difference runs deep: OpenAI nests tool calls under message.tool\_calls as a dedicated field, while Anthropic embeds them as content blocks alongside text blocks. Your iteration logic, tool call extraction, and even the check for 'does this response contain a tool call?' must be provider-aware. The adapter pattern isolates these differences so core agent logic stays provider-agnostic.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T13:30:35.709536+00:00— report_created — created