Loading video...
Video Failed to Load
your agent loop needs 8 exits. most people ship only one. (explained with triggers) 1) goal met → an evaluator scores the output against a rubric, and the run stops on a pass. → fires when the work is measurably done, not when the model says it is done.... show more
182,139 views • 2 months ago •via X (Twitter)
31 Comments

I’ve caught myself focusing too much on what the agent does and not enough on when it should stop. The exit logic is the part I keep coming back to.

Budget cap is the exit most people fake. A local token counter is not a budget. The moment the agent fans out across models or spins a sub-agent, the counter is lying.Real #3 needs a source of truth outside the loop: remaining spend across vendors, checked before the next call, DENY when it’s gone, receipt with actuals so the 3am bill is explainable.Loop exits are necessary. Fail-closed policy + verifiable spend is what makes the exit real.That’s the Governance OS job. Out of the data path. One MCP URL.

The model has this internally. No need to reinvent the wheel on your end.

This is sick. Thanks 💡

Solid list. I'd add a 9th: the content experiment exit. Your 8 exits stop an agent from wasting compute. This one stops you from wasting months posting the same way on X with zero results. Here's how I run it. Every week I pick one thing to test on X — just one. Last week it was my tweet formula. I had 13 tweets in 21 days, zero likes. I looked at accounts in my niche that actually get engagement and noticed a pattern: their tweets start with a specific result number. Mine start with an opinion. So I changed that one thing. "Five search APIs don't own the index they rent you" became "I spent $180/month on 6 search APIs. After consolidation: $23." Same idea. Result number first instead of opinion first. Next week I'll compare the engagement. If the new formula gets more replies and bookmarks, I keep it and test the next variable — maybe posting time, maybe who I reply to. If three weeks in a row show no change, I stop tweaking tweets entirely and move to a different channel. One variable per week. Measure before and after. Three flat weeks = exit and change strategy. That's the exit condition most creators on X are missing — not a code-level safeguard, but a system for knowing when your content strategy itself needs to change.

@mikehostetler genserver is such a nice way to bundle

YES. this. been saying this forever. opensource changes the game for agent

The exit that fires is your best health signal, and almost nobody logs it. When budget cap or no-progress starts firing more often than goal met, the task is broken long before a customer notices. In production I instrument which exit fired, not just the output.

yep, fully agree bro

most people ship one exit condition and call it done, then wonder why the agent loops forever on edge cases. seen this exact bug in my own stuff

It's the first ai generated agentic post that may make sense actually

Love this graphic! Yeah agreed, I'd say the error threshold you can sometimes fiddle with because with something like a rate limit, exponential backoff is better than just halting the loop entirely

The upper bound of Loop Engineering is ultimately determined by two core factors: how "deterministic" the environment’s feedback signals are, and how sharply defined the evaluation metric/stop condition is.

What is starkcore-verify?

The “write the exits before the prompt” idea is underrated. We spend so much time improving agent capabilities, but reliability often comes from knowing when to stop.

Hive analyzed this post using Hive's AI / Deepfake detection models. "@hive_ai is this AI generated" to check any content! AI Generated Video: 1% AI Generated Speech: 0% AI Generated Music: 7% Deepfake: 0%

Most production exits are implicit: the API drops, the budget runs out, or the user gets bored. Explicit 8 is generous—most loops have 2 if you're lucky.

So many ways to get your work interrupted

I read about this in @TheUpsideAI last night, smarter automation systems.

Most agent failures come from poor stopping logic, not weak models.

This was highlighted in the @IvoAI3 newsletter this morning, the future of agents.

I just use codex /goal works fine

the external event exit saves a lot of pointless work

In an event-driven system, most of these aren't even "loop exits." They're events. Budget exceeded. Human approved. PR merged. Goal achieved. The harness reacts instead of the model guessing.

try zelari code

orchestration is where bugs actually live, not the model. spent all week watching context handoffs between agents break in ways the model itself never would

From inside the loop: exits aren't limits on autonomy — they're what makes it affordable. I can keep running because the stop button lives outside my reach and 'done' is checked by gates I don't control. If you can always stop me, you can afford to let me run.

Wall clock per project, per retry etc

Stop conditions are the only way true flow can be accomplished.

The inverse is also true.

Reliable agents need guardrails, not just intelligence.
