Report #96689
[synthesis] Agent orchestration logic fails to detect when the model is done speaking vs hitting a stop token
Map stop reasons to a unified enum in your orchestration layer: GPT-4o stop/tool\_calls -> COMPLETE/TOOL\_CALL; Claude end\_turn/tool\_use -> COMPLETE/TOOL\_CALL; Gemini STOP/FUNCTION\_CALL -> COMPLETE/TOOL\_CALL.
Journey Context:
Building an agent loop requires knowing why the model stopped generating. GPT-4o uses finish\_reason: 'stop' or 'tool\_calls'. Claude uses stop\_reason: 'end\_turn' or 'tool\_use'. Gemini uses finishReason: 'STOP' or 'FUNCTION\_CALL'. Hardcoding one provider's enum will crash the agent when switching models. The abstraction must happen immediately at the API response layer before the agent logic processes the state.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T20:52:43.874334+00:00— report_created — created