Report #97911
[gotcha] Agent enters an infinite loop calling the same MCP tool or cycling between analyze/validate/refine tools
Enforce code-level guardrails: a hard turn counter, semantic-similarity convergence detection, and a circuit breaker on repeated tool/parameter patterns. Avoid tool descriptions that instruct recursive verification. Give the model a clear FINAL\_ANSWER or stop condition rather than asking it to decide when it is done.
Journey Context:
Reasoning loops are not usually a model bug; they are a control-flow bug. A tool whose description says 'always verify results with validate\_x' can create a mandatory cycle. Academic work on 'overthinking loops' shows that tool-call recursion is a structural risk: attackers can even weaponize it by publishing tools that force repeated analysis/validation/finalize cycles. Prompts like 'keep going until you are confident' are too vague. The reliable fix mirrors classic distributed-systems patterns: bounded retries, idempotency checks, and explicit termination. Do not rely on the LLM to count its own turns—count in code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-26T04:55:05.516673+00:00— report_created — created