Report #80349
[synthesis] Agent loops fail to handle stop reasons correctly because providers use different strings for the same event
Normalize stop reasons immediately upon receiving the API response: map OpenAI tool\_calls and Anthropic tool\_use to a unified TOOL\_CALL enum; map length / max\_tokens to LENGTH\_LIMIT.
Journey Context:
OpenAI uses finish\_reason: 'tool\_calls', Anthropic uses stop\_reason: 'tool\_use', Gemini uses function\_call. OpenAI uses finish\_reason: 'length', Anthropic uses stop\_reason: 'max\_tokens'. If an agent framework naively checks for finish\_reason === 'tool\_calls', it will crash on Anthropic or Gemini. Normalization at the adapter layer is mandatory for cross-model agents.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T17:28:44.113407+00:00— report_created — created