What is loop engineering, and why did developers stop prompting their agents?

8 min read

What is loop engineering, and why did developers stop prompting their agents?

For most of 2025, using a coding agent meant typing a prompt, reading the result and typing the next one. You were the loop. In June 2026 a few well known engineers said they had stopped. They built small systems that prompt the agent for them, on a schedule, until a check passes. That practice got a name: loop engineering.

If words like harness or stop condition are new, the glossary for this series defines them from zero.

The short definition

Addy Osmani, who wrote one of the first posts with the term in its title, puts it as replacing yourself as the person who prompts the agent and designing the system that does it instead. The Claude Code team's framing, which Osmani quotes in a follow-up, is that a loop is an agent repeating cycles of work until a stop condition is met.

A useful way to place it is as a stack of layers, which is how an academic paper on the topic (Lulla and colleagues, 2026) lays it out:

LayerWhat you designExample
Prompt engineeringThe words of one request"Fix the failing test in auth.py"
Context engineeringWhat the model seesWhich files, docs and history go in
Harness engineeringOne agent runTools, permissions, the model's own tool-calling loop
Loop engineeringMany agent runs over timeTriggers, stop conditions, state files, budgets, a verifier

The important word in the last row is many. Inside a single run, every agent already loops: it calls a tool, reads the result and decides what to do next. That inner cycle is the agent loop. Loop engineering sits one floor above it, in Osmani's phrase. It decides when a run starts, what counts as done, what gets remembered between runs and when a human gets pulled in.

Animation: the agent loop inside one run, wrapped by an engineered loop that adds a trigger, a verifier, a state file and a stop condition.

Where the term came from

Geoffrey Huntley's "Ralph" technique, from July 2025, was a bash loop that fed the same prompt to a coding agent again and again. It went viral in early 2026. Tools then started shipping loops as features: per the same paper, Claude Code added /loop in March 2026, Codex added goal objects in April, and /goal style commands followed in May.

The name itself landed in early June 2026. The paper traces it to an interview where Boris Cherny, who created Claude Code, said he no longer prompts Claude and has loops running instead, followed within days by posts from Peter Steinberger and Osmani. Kyle Mistele of HumanLayer opened his AI Engineer talk by recalling both.

By the end of June, Andrew Ng described three nested loops on different clocks: the agent coding and testing over minutes, a developer reviewing and steering over tens of minutes to hours, and outside feedback such as alpha testers and A/B tests over hours to weeks.

What a good loop is made of

Different writers list the parts differently, but they keep landing on the same handful. Here is the version I find easiest to remember, with the source for each idea:

  1. A trigger. Something starts each run: a schedule, a new issue, a failing build, a comment on a pull request. Osmani's first building block is automations on a schedule for discovery and triage.
  2. A goal you can check by machine. "Make the code better" is not a stop condition. "All tests pass" or "the Lighthouse score is 90 or above, stop after 5 tries" is. The second example is Osmani's, from his practical guide.
  3. A verifier that is not the maker. A separate check, ideally deterministic code, judges the output. Osmani calls this the maker and checker split, using sub-agents.
  4. State outside the conversation. Each run starts with a fresh context, so progress has to live in files. Osmani's summary is that the agent forgets but the repo does not.
  5. A budget and an exit to a human. Maximum tries, maximum tokens, and a rule for when the loop gives up and asks for help.

The best worked example: a loop built like a thermostat

The most concrete account I found is Mistele's talk, "Loop Engineering from First Principles". Piping a prompt into a loop, he says, produces huge pull requests nobody wants to read. His fix comes from control theory, the idea behind a thermostat.

A control loop has a set point (the state you want), a sensor (which measures where you are), a controller (which picks a small change) and an actuator (which applies it). Then you measure again. They fit when you can measure the problem and get feedback on each change.

His team uses one to migrate their RPC API to the Effect library, one procedure at a time:

  • Sensor: an AST grep rule finds every procedure not yet migrated. It is plain code, not a model.
  • Controller: code picks the smallest unmigrated procedure. Mistele says he does not think you should ever send an agent to do deterministic code's job.
  • Actuator: a coding agent with a skill and hand-written "golden patterns" makes the change, and a script opens the pull request.
  • Schedule: CI runs one iteration a day, so each morning there is one small pull request to review.
  • Steering and flow control: reviewers leave feedback in a markdown file the loop reads every run, and if the loop's last pull request is still open, the next run simply shuts down. At most one pull request per loop is ever waiting.

He gives one number about speed: with 150 procedures to migrate, one a day would take about six months, so once the loop is trusted the controller can pick several at a time.

Animation: sensor, controller and actuator in a cycle, migrating one item per run, with a gate that skips the run while the last pull request is still open.

Where the skeptics have a point

Loop engineering has real critics, and the sources are honest about them.

  • It may be a renamed cron job. The academic paper reports that critics say exactly this. A schedule plus a script plus a check is not new.
  • The evidence is thin. The same paper surveyed the gray literature and found broad agreement on what a good loop has, but "no systematic evidence" that loops deliver the benefits people claim.
  • It can burn money. Osmani is openly wary of token costs, and Mistele notes that this style is expensive if you do not work at a frontier lab with an unlimited token budget.
  • It can scale slop. A loop repeats whatever a single run does, sloppy code included. Lauren Tan made this point in her AI Engineer CODE talk, which the inner and outer loop post in this series covers.

My own view: the useful core is the stop condition. If you cannot write down, in code, what "done" means for a task, a loop will not save you. If you can, a loop is often the cheapest way to get there.

How to start small

Osmani's advice is to start with the simplest solution, and Mistele's talk ends in the same place. Pick one boring, measurable chore, write the sensor as plain code, let an agent fix one instance per run, run it once a day and read every pull request. Add a budget, and a rule to skip the run while the last change is unreviewed.

If you want to build the agent itself first, the Build an AI Agent in Python course starts with a plain agent loop in Python and adds step limits and budgets later. The next post covers the term that followed loops a few weeks later: graph engineering.

Sources