Your OpenClaw agent is stuck in a loop. It keeps calling the same tool, getting the same empty result, and calling it again. Or it is retrying a task over and over while your token counter climbs. You are not alone, and it is not a random glitch. Looping is one of the most common OpenClaw failure modes right now, and it got noticeably worse for a lot of people after the 2026.7.1 release.
The good news: you can stop a loop in minutes, and you can set up guards so it stops happening. Here is exactly how.
First, Understand the Difference: Stuck vs Looping
Stuck means the agent is waiting on something that never arrives: a tool that hangs, a gateway that stopped responding, a node that went offline. Looping means the agent is actively working, but in a circle: calling a tool, getting a result that does not advance the task, and calling it again.
The two look similar from the outside, but the fixes are different. A stuck agent needs a restart or a timeout. A looping agent needs a stop condition. Most of this guide is about looping, because that is the one that burns tokens while looking busy.

How to Detect a Loop Fast
You do not need to watch the transcript for an hour. Check these three things:
- Look for repeated identical tool calls. The same tool name with the same or near-identical arguments, three or more times in a row. That is a loop signature, not a coincidence.
- Watch for empty or failing results. A tool that returns zero results, an error, or nothing at all, followed by the agent trying it again. When a search returns nothing, agents often assume the search was wrong instead of concluding the data is absent.
- Check your token usage. A session burning tokens with no visible progress is almost always looping. OpenClaw’s session views and cost estimates make this easy to spot.
How to Stop a Loop Right Now
1. Kill the session
The fastest stop is to end the session or task. In the TUI, interrupt the current run. For a cron or background task, cancel it from the task list. This stops the token burn immediately.
2. Restart the gateway if the loop survives
Some loops are driven by a wedged tool or a stuck plugin state that survives session resets. If the agent starts looping again right after you restart the session, restart the gateway. This clears plugin and tool state that a fresh session does not.
3. Disable the offending tool temporarily
If the loop is tied to one tool (a search that returns nothing, a browser action that fails), disable that tool in the config, restart the session, and let the agent complete the task without it. Then investigate the tool separately.

How to Prevent Loops From Happening
Stopping a loop once is good. Making them rare is better. These are the guards that work:
Set a max turns cap
Most agent harnesses support a maximum number of turns or steps per task. Set it. A task that needs 5 turns should not be allowed to run 200. The cap acts as a backstop: when the agent hits the limit, it stops and reports instead of circling forever.
Add cooldowns and retry limits to cron jobs
Cron and heartbeat tasks are where loops get expensive, because they run unattended. Add a cooldown between runs and cap retries. One common setup: a 30-second cooldown and a maximum of 3 retries. Users report cutting token usage roughly 40% with this alone, before any other optimization.
Turn on thinking for multi-step work
For debugging, analysis, and anything with several steps, enable thinking mode. Thinking lets the model reason before acting, which dramatically reduces impulsive repeated calls. It costs a little more per call and saves a lot more in avoided loops.
Give tools clear terminal states
A lot of looping is a tool problem, not an agent problem. If a search tool returns an empty list, the agent has no way to know “no results” is a valid answer. Skills and tools that return explicit empty-state results, with a note like “no matches found, this is a complete result,” give the agent a reason to stop.
Watch for known-bad versions
The 2026.7.1 release was widely reported to introduce or worsen infinite-loop behavior. If you updated recently and loops started appearing, check the release threads and consider rolling back to the previous version until the regression is fixed. Our rollback guide walks through doing this safely.
A Quick Checklist for Loop-Prone Tasks
Before you set any agent loose on an unattended task, run this:
- Does the task have a clear completion condition the agent can recognize?
- Does it have a max turns cap?
- Does it have a retry limit and cooldown?
- Do the tools involved return clear empty states?
- Is the model one that handles tool-heavy sessions well?
- Are you on a known-stable OpenClaw version?
If you can answer yes to all six, the task will almost never loop. If you cannot, expect to babysit it until you fix the gaps.
Bottom Line
Loops are the most expensive invisible failure in OpenClaw: the agent looks busy, the task never finishes, and tokens drain the whole time. The fix is a combination of fast detection (repeated identical calls), fast stopping (kill the session, restart the gateway), and prevention (turns caps, cooldowns, thinking mode, clear tool states).
Set the guards once and looping becomes a rare event instead of a weekly surprise.
Worried your agent is burning tokens right now?
Token costs and looping go hand in hand. The token cost guide covers capping usage and spotting runaway sessions before they get expensive.

