Report #40979
[synthesis] Inconsistent API stop reasons breaking agent loop termination logic
Map all provider-specific stop reasons to a unified internal enum \(e.g., \`END\_TURN\`, \`MAX\_TOKENS\`, \`TOOL\_CALL\`\). Do not assume \`stop\` means the same thing across OpenAI, Anthropic, and Google.
Journey Context:
Agent frameworks often assume a universal 'stop' condition. OpenAI uses \`stop\` for natural end and \`tool\_calls\` for tool use. Anthropic uses \`end\_turn\` for natural end, \`tool\_use\` for tools, and \`max\_tokens\` for length. Gemini uses \`STOP\`, \`RECITATION\`, and \`SAFETY\`. If an agent framework assumes \`stop\` means 'done', it will break on Anthropic or loop infinitely on Gemini. Normalization is mandatory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:15:14.075235+00:00— report_created — created