---
title: "When to stop an AI agent loop: set the stop rule before the progress report looks promising"
slug: when-to-stop-ai-agent-loop
date: 2026-11-30
excerpt: "We tend to blame sunk cost when we keep re-running an agent that is not getting there. A failed replication points at something else: we invest in whatever looks promising, and agent updates are written to look promising. The fix is a stop rule you set before the run starts."
featured_image: "https://bbtxujdxvidaghmhxkqs.supabase.co/storage/v1/object/public/generated-images/blog-1796019622694-when-to-stop-ai-agent-loop.webp"
featured_image_alt: A navy stop block crosses the entry to a slate looped track on white paper.
author: Kinan Hamwi
author_url: https://www.linkedin.com/in/kinanhamwi/
canonical_url: https://cerevisor.com/blog/when-to-stop-ai-agent-loop
updated_at: 2026-11-30T06:05:11.75379+00:00
---

# When to stop an AI agent loop: set the stop rule before the progress report looks promising

By the Cerevisor team. Every claim here about how Cerevisor behaves was checked against the app's source code on 30 November 2026.

TLDR

When an agent keeps almost finishing, the usual story is sunk cost: we have put in so much that stopping feels like waste. The research is shakier than that story, and it points somewhere more useful. People put more into whatever looks promising, and an agent's progress update is about the most promising-looking thing on the screen. So the decision to stop has to be made before the run, on a written test, not in the middle of it.

Last Tuesday, 24 November, Anthropic shipped Claude Code version 2.1.332. One line in its [release notes](/blog/cerevisor-v38-local-ai-agents-lasting-conversation) is a small lesson in self-control. It fixes a case where Claude Code kept trying to shrink a long conversation into a summary and kept getting cut off, and the new rule reads: “after three cut-off replies, the last try now asks for a shorter summary.” In plain words, the tool now has a written point at which it stops repeating the same move and changes approach.

That is a rule a machine follows easily. The person watching an [agent work](/blog/harness-ai-agent-governance-patterns) through a fourth, fifth and sixth attempt at the same fix usually has no such rule, and that is where the operator’s head comes in.

---

## The sunk cost story about agent retry loops

Here is the belief most of us carry. An agent retry loop is when we send an agent back to try again, then again, because the last attempt was close. We keep going, the story says, because of sunk cost: the half hour already spent feels like an investment we would be throwing away.

The classic study behind this is Barry Staw’s 1976 paper, “Knee-deep in the big muddy.” It introduced escalation of commitment, which is the tendency to put more into a failing plan when we were the one who chose it. Business students who felt personally responsible for a bad early decision committed more money to rescue it. It is a tidy explanation, and it fits the feeling of babysitting a stubborn agent at 6 pm.

## What the replication of escalation of commitment actually found

Tidy explanations deserve a second look. In 2021 a team led by Michał Białek tried to reproduce Staw’s experiment with a much larger group, and it did not hold up.

> "No evidence for escalation of commitment amongst the participants was found (N = 365). Participants simply invested more in more promising projects."

Białek, Węgrzyn and Meyers, Economics and Business Review, 2021

This does not mean sunk cost is a myth. A 2012 review in the Academy of Management Journal pulled decades of escalation studies together and found the effect is real but depends heavily on the situation. What the replication does is shift the weight. In that experiment, the thing that drove people to keep investing was not pride in their earlier choice. It was how good the project looked right now.

Key Insight

The pull to keep going comes less from what we have spent and more from how promising the next step looks. An agent's update is written to look promising, whether or not the work is converging.

## Why agent progress updates keep us in the loop

Think about what a [language model](/blog/small-language-model-laptop-no-gpu) produces at the end of a failed attempt. It is fluent, it is confident, and it usually names a specific next step: “I found the issue, the test was reading the old config, one more change should fix it.” Every one of those updates reads like a promising project. If the replication is right that promise is what pulls investment, then an agent is close to an ideal machine for keeping a person in the loop, with no bad intent from anyone involved.

That also explains why willpower fails here. Mid-run, we are judging the update, and the update is persuasive by construction. The judgment we need is a different one: did the work pass a test we wrote down before we saw any of the persuasive updates?

> The time to decide when to stop an [AI agent loop](/blog/local-runaway-agent-loop-turn-caps) is before the first progress report, because every report after that will sound like the last one before success.

---

## How a stop rule works in Cerevisor’s loop connections

This is the part we can speak to from inside the product. Cerevisor is a desktop app where you lay out several AI agents as a workflow on a canvas and connect them. One kind of connection is a loop: an arrow pointing backward from a later agent to an earlier one, which sends the work round for another pass.

A loop has two settings, and both are chosen when the workflow is built, before anything runs:

- **Max iterations.** The most passes the loop may take. It starts at 3 when you create a loop, and you can change it.

- **Loop condition.** An exit condition, written in plain language, that is checked against the later agent’s output before each extra pass. For example: “the draft is at least 600 words and includes all three required sections.”

Two details in the code are worth knowing because they are the stop rule doing the job our tired brain would not. First, the exit [check never](/blog/local-ollama-agent-harness-connection) asks a person. If the checker cannot tell whether the condition passed, the loop exits rather than going round again, and if the checker itself fails to answer, the loop also exits. When in doubt, the default is to stop. Second, the run’s spending limit and its limit on total agent turns are checked before every extra pass, so a loop cannot quietly outspend what the workflow was given. If the cap is reached without the condition passing, the loop ends with the last pass’s output and the rest of the workflow carries on.

None of that requires anyone to judge a progress update in the moment. The stop decision was made earlier, by the same person, while they were still calm. The full setup is in the Cerevisor guide to [loops, conditions and approval gates](https://cerevisor.com/docs/guides/building-workflows/control-flow-conditions-loops-gates).

3

passes is where a new Cerevisor loop starts, set before the run so nobody has to decide mid-flight

## An AI agent exit condition you can write today

The same idea works outside any particular tool. Before sending an agent back for another try, write two lines somewhere you will see them:

- **The test.** One sentence describing what done looks like, checked against the output, not against the agent’s description of the output. “The failing test passes and no other test breaks” beats “the agent says it is fixed.”

- **The count.** How many more attempts this is worth before the approach changes. Changing approach can mean a smaller task, a different agent, or doing that piece by hand.

Claude Code’s release note is a good model for the second line. It does not say “give up after three.” It says that after three cut-off replies, the last try asks for something different. The count is a trigger to change approach, not a verdict on the work.

---

## What this means when choosing an agent orchestration tool

For anyone evaluating a local-first orchestration tool, one that coordinates several agents on your own machine, the practical question is simple. Can the stop rule live in the workflow itself, written down once and enforced every run, or does it live in the operator’s patience? Patience is the part that runs out first, and on the evidence above it is also the part most easily talked round by a confident update.

Our next action for any workflow that sends work round more than once: open each loop, check that it has a written exit condition and a pass count chosen on purpose rather than left at whatever it started with, and write both down for the loops that still live only in our heads.

#### Sources

- [Escalation of commitment is independent of numeracy and cognitive reflection. Failed replication and extension of Staw (1976)](https://doi.org/10.18559/ebr.2021.2.2) - Economics and Business Review

- [Knee-deep in the big muddy: a study of escalating commitment to a chosen course of action](https://doi.org/10.1016/0030-5073(76)90005-2) - Organizational Behavior and Human Performance

- [Cleaning Up the Big Muddy: A Meta-Analytic Review of the Determinants of Escalation of Commitment](https://doi.org/10.5465/amj.2010.0696) - Academy of Management Journal

- [Claude Code changelog, version 2.1.332](https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md) - Anthropic (GitHub), 2026-11-24

- [Control flow: conditions, loops, gates](https://cerevisor.com/docs/guides/building-workflows/control-flow-conditions-loops-gates) - Cerevisor Docs
