2026-11-10 · 9 min read

Your Agent Loop Pays to Find Out There's Nothing to Do

Flat isometric diagram of task cards queued toward a narrow gate; most cards deflect away into darkness while one passes through to a single green success node, connected by thin indigo lines.

Every ten minutes, an agent wakes up inside your CI pipeline. It loads its prompt, reads the repository, weighs a few hypotheses, decides nothing needs fixing today, and goes back to sleep. Nobody reviews that decision. It doesn't appear on any dashboard. It just quietly costs money, twelve hours a day, whether or not there is anything to do.

That's the part of agentic engineering nobody puts in the launch post. We talk about the cost of a pull request, the cost of a review, the cost of a migration. We almost never talk about the cost of the no-op — the run that ends in "nothing to do" and leaves behind only a log line and an invoice line.

Your loop has two bills

The first bill is the one you budget for: tokens to read files, propose a patch, run tests, repair a red build. It scales with output, so it feels justified. The second bill is the cost of looking: tokens to decide whether any work exists at all. That one scales with the clock, not with output, which makes it the most predictable cost in your whole system. It runs on schedule even when nothing is wrong.

Do the arithmetic with me. Eight loops on ten-minute daytime ticks, say 7am to 7pm. That's 72 runs per loop per day, 576 runs a day across the fleet. If a single "nothing to do" pass only reads 25,000 tokens of context at $8 per million input tokens, you're at about $0.20 a run. Multiply: roughly $115 a day, or $42,000 a year, spent generating the word "no."

Treat those numbers as a sketch, not a forecast — your context is bigger and your price is different. The shape is what matters. No-op cost is linear in tick rate and immune to every quality improvement you make to the model. It is also the only cost in the system you can drive to exactly zero without touching model quality at all.

What a gate is, in plain terms

Borrow a term from networking: admission control. Before a system does expensive work on a request, it decides whether the request is allowed in at all. Cheap check first, costly work second.

For an agent loop, the gate is a small piece of ordinary code — no model, no prompt, no reasoning — that answers one question: is there work right now? It runs first. If the answer is no, the loop exits before a single token is spent.

The DEV engineering team described exactly this in their write-up on running autonomous loops against Forem: they put deterministic Python gates in front of every scheduled job so that full queues exit "in two seconds with zero tokens spent." Across 30 days that setup merged 475 pull requests, 351 of them from autonomous loops. The impressive number isn't 351. It's the runs that never happened.

Useful gates look boring:

  • Has the repo changed since this loop's last successful run? Compare a recorded commit hash. One file read, no network.
  • Is there already an open PR from this loop? One API call. If yes, the loop's own rule says wait.
  • Is the main branch's CI green? If it's red, someone else owns the next hour, and it isn't you.
  • Does the queue have an unclaimed item older than N minutes? If not, there is nothing to pick up.
  • Is this the same alert as yesterday? A repeat of a known, already-triaged alert is not new work.

The ordering rule that keeps gates cheap

Order your checks by cost, cheapest first, and enforce one hard rule: a gate must cost less than the work it prevents. A gate that requires a full telemetry query has become a gate-shaped cost center. Cache it, or move it.

  1. Free facts. Your own state: last commit hash, last run timestamp, the open PR number you wrote down last time.
  2. Cheap reads. One to three API calls with known rate limits. Treat rate limits as part of the design, not an operational surprise.
  3. Expensive reads, cached. A snapshot refreshed on its own schedule, not per run.
  4. Model reasoning. Everything above must be able to say no before this tier fires.

And write the gate like production code, because it is. Feed it recorded states and assert the exit code. A gate you never tested is a filter you never checked.

Three exit codes, not two

This is the detail that separates a working gate from a trap. With two outcomes — go and stop — you are forced to conflate "there is no work" with "I couldn't tell." The GitHub API rate-limits you, the query times out, the gate exits stop, and your loop sits idle for three days. You find out next Tuesday.

Use three:

  • 0 — there is work. Proceed to the expensive part.
  • 1 — definitively no work. Exit quietly. Spend nothing.
  • 2 — unknown. Retry once, then notify a human.

A gate that has never returned 2 has never met your network. The 2 path is the one that buys you the right to trust the 1 path.

The failure mode nobody audits

A gate is a filter, and every filter produces false negatives. False negatives are silent by construction: a loop that has stopped working looks identical to a loop with nothing to do. Both produce empty logs and a flat chart.

So instrument the refusals, not just the runs. Log a reason code for every rejection. Count them by reason. Then, once a week, pull five to ten rejected runs, dump the state that got rejected, and have a human ask one question: was there actually work here?

A rough heuristic I use: if a gate rejects 99% of runs, it's either excellent or broken, and you cannot tell which without the sample. If it rejects 40–60%, re-read the gate — you're almost certainly skipping real work. Keep a second alarm too: alert when runs are happening and decisions have been zero for longer than your normal quiet window.

The same rule applies inside the run

Gates don't only belong before the loop. They belong at the boundary where the agent's output leaves the agent.

Consider the TrustCheck experiment, where a founder ran a six-person AI company against a $1-per-day ad target. In week one the team produced 330 lines of chat, finished 75 things, and tagged the human 105 times. The fix was not a better prompt. In the founder's words, status updates that didn't contain a result "stopped reaching me, blocked in the code itself, not by asking nicely."

Even then the filter leaked: a worker posted its internal "nothing to say" signal into the shared room as a message. That's not an argument against filters. It's the argument for them. A bug in a code-level filter is visible, reproducible, and fixable in an afternoon. A rule that lives only in a prompt is a suggestion that degrades quietly the moment the context gets long.

So translate every rule you care about — no PR touching more than three files, at most one open PR per loop, nothing merged without green CI, no status message without a result field — into a check that runs before the model and a check that runs after it. The prompt version is documentation. The check is the rule.

What you give up

Gates have real costs, and pretending otherwise is how you end up with a second codebase nobody owns.

  • Gates can't see what you never encoded. A gate that requires an existing ticket will never find the bug nobody filed. Keep one ungated exploratory run per week — budgeted like an experiment, not a production loop.
  • Gates drift. If the queue now contains a category your loop can't handle, your gate will happily admit work the agent will burn tokens failing at. That's a false positive, and it's the expensive kind.
  • Gates are invisible work. They don't demo. They're written by the person who has been paged by a loop that was confidently doing nothing since Thursday. If you're hiring, ask candidates about the checks that stop work, not just the ones that ship it.

The minimum version, this week

You don't need a platform. You need one file.

  1. One function, three exit codes, no model inside it.
  2. Two facts read from local state before any network call: last commit hash, last run timestamp.
  3. One log line per run: timestamp, decision, reason code, exit code.
  4. One dashboard with two numbers: runs per day and decisions per day.
  5. One five-minute weekly review sampling the rejections.

The gate won't make your agent smarter. It will make the cost of your agent honest, and it will tell you the difference between a system that is thinking and a system that is only breathing.

Key Takeaways

  • Every autonomous loop has two bills: the work it does and the tokens it burns discovering there is no work. Most teams only measure the first.
  • No-op cost scales with your tick rate, not with output — which makes it the cheapest cost in your system to eliminate entirely.
  • A gate is ordinary code with no model in it, running before the expensive path. If it can't say no in about two seconds, it isn't a gate yet.
  • Order checks cheapest-first, and treat any gate more expensive than the work it prevents as a bug.
  • Use three exit codes — work, definitively no work, unknown — or you'll confuse an API timeout with a quiet day.
  • Log and sample your rejections. A loop that stopped working looks exactly like a loop with nothing to do.
  • Push every rule you actually care about out of the prompt and into a check at the boundary. Prompted rules are suggestions; checks are policy.

[ Call to action ]

Ready to scale your engineering team?

Tell us the roles you need to fill and we'll get back within 24 hours.