Failure Index / Agent behavior · warning · LangChain · OpenAI Agents SDK · CrewAI

Agent stopped due to iteration limit or time limit

The agent hit its safety cap on steps before finishing. Nine times out of ten this is not 'the limit is too low' — it's the agent stuck in a loop, repeating a failing call or oscillating between two tools.

The error

Agent stopped due to iteration limit or time limit
langchain max iterations agent
openai agents MaxTurnsExceeded

Root cause

A tool keeps failing (auth, bad input) and the agent keeps retrying it; or the model can't decide between tools and ping-pongs; or the task genuinely needs more steps than allowed. Raising the limit without reading the trace just makes the loop more expensive.

The fix

Read the run step-by-step and find the repetition. Fix the underlying failing tool or the ambiguous tool descriptions that cause oscillation. Only raise max_iterations when the trace shows real, non-repeating progress being cut off.

Preventing it next time

Alert on repeated identical (tool, input) pairs within a run — loops are detectable by step 3, long before the iteration cap burns your token budget.

Stop debugging this by hand. Vorlo watches your agent and, when this failure happens, hands you the diagnosis and the fix — verified by developers who hit it before you — in your dashboard, Slack, or your editor. Two lines of code: pip install vorlo-trace · npm install vorlo-trace. Start free

Related failures