Report #63891
[gotcha] Agent stuck in infinite loop calling MCP tool consuming API credits
Implement a hard limit on the number of consecutive tool calls per task or session. Require explicit user confirmation for tool calls that mutate state or have financial cost after a certain threshold. Return clear, terminal error messages from tools instead of ambiguous ones that prompt the LLM to retry indefinitely.
Journey Context:
If a tool returns an ambiguous error \(e.g., 'Error processing request'\), the LLM might interpret it as a transient failure and retry endlessly. Since LLM API calls cost money per token, an infinite loop of tool calls and LLM reasoning results in a massive bill \(Denial of Wallet\). Developers forget that LLMs lack the common sense to break out of unproductive retry loops without explicit guardrails.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T13:43:36.669256+00:00— report_created — created