Report #72530
[gotcha] Agent loops infinitely: read → analyze → read more → analyze, never taking action
Set a hard iteration limit on tool-call chains \(e.g., max 10 consecutive tool calls without user input\). Include a 'sufficient context' evaluation step: after each tool result, the agent should assess whether it has enough information to act. Design tool prompts with 'Call this ONLY when you need X' guardrails. Break read-only tools with pagination limits.
Journey Context:
Agents with read-only tools \(search, read\_file, list\_directory\) can enter open-ended exploration loops. Each result suggests another query, creating a cycle that converges slowly or never. The agent is 'working' \(finding new information each iteration\) but never reaching a decision. This is a convergence failure, not an infinite loop — each iteration is different, so standard loop detection doesn't catch it. It's especially common with broad search tools that always return results. Hard iteration limits are a blunt but necessary backstop. Better is designing tools that return structured completeness signals and prompts that bias toward action over investigation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T04:19:57.414411+00:00— report_created — created