OpenRouter Announcements·· 3 days agoAI score58
How to Stop an AI Agent Stuck in an Infinite Loop
How to Stop an AI Agent Stuck in an Infinite Loop
AI summary
OpenRouter describes four guards against runaway agent loops, tested on six models with its Agent SDK (@openrouter/agent 0.11.0): doom-loop detection, a loopKey that normalizes tool arguments, stopWhen caps on steps and cost, and a credit limit on the API key. With doomLoop: true, all six models were blocked on their third identical tool call, and across 18 runs detection cut tool calls from 314 to 64 and spend from $0.29 to $0.05. The article notes that loops vary between runs and that only the key-level limit caps total spend when agent code is buggy or caps are missing.
Source: OpenRouter Announcements · openrouter.ai