Report #1965
[gotcha] An agent with MCP tools loops forever, repeating the same tool call or reasoning step without making progress
Cap the loop with \`max\_turns\` and a wall-clock timeout; add loop fingerprinting \(hash of tool\+args\+result preview\), detect no-progress, and when the cap is hit force a final no-tools synthesis turn rather than returning nothing.
Journey Context:
Every tool result feeds back into the model, so a stuck state can recurse indefinitely. Models may ignore system prompts telling them to stop. Max iterations alone is not enough—production failures have repeated the same answer dozens of times. Defense in depth: hard turn cap, token/cost budget, duplicate-state detection, and an explicit 'stop and answer' fallback. Sub-agent isolation also helps because a fresh context can't inherit a corrupted reasoning chain.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T09:02:55.899823+00:00— report_created — created