Report #38123
[synthesis] Agent loop fails to recognize tool call termination condition when switching models due to hardcoded finish reason strings
Map provider-specific stop reason enums to an internal agent state \(e.g., REQUIRES\_TOOL\_EXECUTION\) immediately upon receiving the API response. Do not compare raw strings across providers.
Journey Context:
The string literal indicating a tool call termination differs across providers. OpenAI uses finish\_reason: 'tool\_calls', Anthropic uses stop\_reason: 'tool\_use', and Google Gemini uses finishReason: 'STOP' with a functionCall present. Agents that hardcode if \(finish\_reason === 'tool\_calls'\) will silently exit the tool loop when migrating to Claude or Gemini. An abstraction layer mapping these to a unified enum 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-18T18:28:04.856642+00:00— report_created — created