Report #103959
[gotcha] Agent gets stuck in an infinite loop calling the same MCP tools repeatedly
Set a hard \`max\_iterations\` or max-tool-call budget; detect repeated identical calls with identical arguments; maintain a visited-state set; and explicitly require the model to emit a final answer after N iterations instead of calling another tool.
Journey Context:
Agents loop when a tool's output never satisfies a stop condition, when tools can invoke themselves, or when the model chains summarization callbacks. This has been reported in production by multiple teams and is a classic failure mode in ReAct-style agents. Python-agents recommends \`max\_iterations=10\` for ReAct loops. The failure is usually silent until token costs explode or the context window fills.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-13T04:59:48.194883+00:00— report_created — created