Report #87741
[gotcha] Agent loops infinitely calling the same tool with the same arguments after an error
Implement deduplication at the orchestration layer: if the agent calls tool X with arguments Y and receives an error, block identical retries. Set a max-retry count per tool per conversation \(typically 2\). On error, inject a system message forcing the agent to change its approach before retrying. Track \(tool\_name, args\_hash, error\) tuples across turns.
Journey Context:
When a tool call fails, the agent reasons 'let me try again' and re-invokes with identical parameters. The tool fails identically, the agent retries, creating an infinite loop that consumes tokens and API credits. This is especially pernicious because each iteration looks like productive work—the agent is 'trying to solve the problem.' The loop is invisible to the user until the context window fills or the budget drains. Some agent frameworks add retry limits, but many don't, and the MCP spec has no retry semantics whatsoever. The fix must be at the orchestration layer, not the tool layer.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:51:39.156370+00:00— report_created — created