OpenClaw

OpenClaw agent stuck in a loop

An agent loops when a weaker model keeps re-issuing the same tool call instead of progressing, usually from poor tool-calling reasoning or no step cap, and every retry burns tokens. Stop the runaway agent first, switch to a stronger tool-calling model, set maxIterations (e.g. 15) and a per-task cost ceiling, and tighten the system prompt.

Likely cause

A weaker model keeps re-issuing the same tool call instead of progressing, usually from poor tool-calling reasoning or no step cap on the agent.

The fix

  1. 1 Stop the runaway agent, then switch to a stronger tool-calling model.
  2. 2 Set maxIterations (e.g. 15) or a max-steps limit and a per-task cost ceiling.
  3. 3 Tighten the system prompt so the goal is unambiguous.
docker restart openclaw
Full guideOpenClaw Agent Stuck in Loop: How to Stop It

Hit a different error?

Paste any agent error and get the cause and fix in seconds.

Open the decoder

Frequently asked questions

How do I stop a loop that's running right now?

Kill the process immediately rather than waiting for it to finish, since every second costs money. Use docker restart openclaw (or docker stop), then check your provider's usage dashboard to assess the damage before restarting with guardrails.

How expensive can a loop actually get?

A single stuck loop can burn $5-50+ per hour. One documented case hit $350 in 3.5 hours over 800+ consecutive turns. Without maxIterations or a cost ceiling, an overnight loop can consume your monthly budget.

Is this a bug, or expected agent behavior?

It's largely expected. Agents run a reason-act-observe cycle and will retry persistently when tool feedback is ambiguous. OpenClaw has no built-in cost cap or circuit breaker, so you must add maxIterations, retry limits, and cost ceilings yourself.

Stop firefighting agent errors

Decoding errors one at a time is the manual version of what BetterClaw automates. Run your OpenClaw agents hosted with managed models, retries and config validation built in.

$19/month per agent · BYOK · 7-day money-back guarantee