Report #88645
[synthesis] Agent orchestration loop crashes on unknown stop\_reason when switching LLM providers
Implement a normalization mapper in the agent framework that translates provider-specific stop reasons \(OpenAI: tool\_calls, Anthropic: tool\_use, Gemini: FUNCTION\_CALL\) into a unified internal enum \(e.g., REQUIRES\_ACTION\).
Journey Context:
Agent state machines rely on the finish\_reason to decide whether to return text to the user or execute a tool. OpenAI uses stop and tool\_calls. Anthropic uses end\_turn and tool\_use. Gemini uses STOP and FUNCTION\_CALL. Developers hardcoding OpenAI's tool\_calls string into their router will crash the moment they swap to Anthropic or Gemini. The abstraction must happen at the adapter layer, as no provider adheres to a standard finish-reason schema.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T07:22:40.286692+00:00— report_created — created