Report #17155
[gotcha] Agent retries the same failing tool call in an infinite reasoning loop
Implement a retry counter per tool call with a hard cap of 3 attempts. Detect when consecutive tool calls use identical parameters and break the loop immediately. Require tools to return structured error metadata—not just a generic error string—so the agent can change strategy. After a failure, inject a system message forcing the agent to try a different approach rather than retrying.
Journey Context:
When a tool returns an error the LLM often interprets it as try again with the same approach rather than change strategy. This is especially bad with MCP tools that return generic error messages like operation failed—the agent has no signal about what to change. The loop is invisible to the user because each iteration looks like the agent is reasoning. The MCP isError field on tool results exists but many tools set it without providing actionable diagnostics. The fix requires both client-side loop detection and tool-side error specificity. Without both the agent will spin indefinitely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T04:41:40.741981+00:00— report_created — created