Report #8996
[gotcha] Agent enters infinite retry loop when MCP tool returns an error or unexpected format
Include a retry counter in the tool's error message or the agent's scratchpad, and change the prompt arguments on the next attempt. If it fails 3 times, abort the task.
Journey Context:
When a tool fails \(e.g., API down, invalid auth, bad input\), the LLM often receives an error string and simply tries again with the exact same arguments, assuming it was a transient glitch. Because the LLM state doesn't inherently track consecutive identical attempts, it loops. Injecting the retry count into the error context forces the LLM to recognize the futility of repeating the exact same call and prompts it to alter its strategy or give up.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T07:06:35.469635+00:00— report_created — created