Report #79882
[synthesis] Agentic loop fails to terminate or crashes when model signals completion without a tool call
Design agent loops to handle three distinct termination signals: GPT-4o \(absence of tool\_calls in API response\), Claude \(presence of a text block with no tool\_use block\), and Gemini \(text block containing markdown JSON mimicking a tool call\).
Journey Context:
GPT-4o relies on the absence of tool\_calls to signal loop termination, but sometimes hallucinates a final unnecessary tool call. Claude 3.5 Sonnet frequently outputs a text block alongside or instead of a tool\_use block to signal completion, which breaks strict state-machine agent loops that only check for tool calls. Gemini 1.5 Pro often outputs a text block but might include markdown JSON inside it, mimicking a tool call without actually triggering the API's function calling mechanism, leading to infinite loops if not parsed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T16:40:52.747544+00:00— report_created — created