Report #39879
[synthesis] Agent loop hangs or double-executes tool calls when switching between GPT-4o and Claude
Normalize tool call responses into a canonical list immediately upon receipt. OpenAI returns \`tool\_calls\` as an array on the assistant message \(supports multiple parallel calls natively\). Anthropic returns \`tool\_use\` content blocks inside a \`content\` array. Build an adapter that extracts all tool calls from whichever structure is present, dispatches them all, then collects all results before sending the next message. Never assume single-tool-call-per-response.
Journey Context:
Teams assume tool calling is standardized across providers. It is not. OpenAI's API natively supports \`parallel\_tool\_calls\` and returns multiple tool calls in a single assistant turn. Anthropic's API returns content blocks that can include multiple \`tool\_use\` blocks alongside text blocks. If your agent loop assumes one tool call per response \(common in early implementations\), it will either hang waiting for a response that already arrived or double-execute by processing the same call twice. The adapter pattern is small but critical: map both formats to \`\[\{id, name, arguments\}\]\`, dispatch all, collect all results, then respond. This also future-proofs against new providers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:24:36.897194+00:00— report_created — created