Report #36539
[agent\_craft] Agent enters infinite loop or exceeds API costs due to unbounded tool use iterations
Hard-cap iterations at 5-10 for simple tasks, 15 for complex multi-step, and implement a 'stuck detector' that triggers if the same tool is called with identical arguments twice.
Journey Context:
The ReAct pattern \(Thought-Action-Observation\) has no inherent termination condition except the LLM emitting a finish action. In practice, models often hallucinate progress and loop: 'I need to check the file' -> read -> 'Now I need to check the file again'. Without a hard limit, this burns tokens and API budget. LangChain defaults to 15 iterations for a reason. The 'stuck detector' \(deduplication check\) catches the most common failure mode where the agent repeats identical failed tool calls. Alternatives like 'ask user for clarification' are high-friction; hard limits with summarization are more robust.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:48:25.879704+00:00— report_created — created