
Loop Engineering: Design Loops, Not Prompts

The shift: from writing prompts to designing loops
For two years, working with AI looked like this: write a good prompt, read the answer, correct it, ask again. The human was the loop.
That is changing. In June 2026, Boris Cherny, creator of Claude Code at Anthropic, summed it up: "I don't prompt Claude anymore. I have loops running that prompt Claude." Peter Steinberger, creator of OpenClaw, said the same from the other side: the skill is no longer prompting agents, it is designing the loops that prompt them.
That practice is called Loop Engineering: designing the system that finds the work, hands it to an agent, verifies the result, saves the progress, and decides the next step, without a human in every turn.
It is not a framework or a product. It is a different level of work, and it changes what you build: you no longer optimize an instruction, you optimize a complete cycle.
One honest warning before we go on: the term is new and systematic evidence of its benefits is still thin. The foundations are solid (at its core, it is automation with verification), but anyone selling it as proven magic is getting ahead of the data. At SolarDevs we treat it for what it is: an emerging practice with strong engineering sense, whose results you have to measure on your own team.
What an agentic loop actually is
An agentic loop is the cycle an agent runs to reach a goal:
Goal → Reason → Act (tool) → Observe the result → Adjust → Done? → Repeat or deliver
We already covered that basic loop in our guide to building an agentic system. Loop Engineering starts one level up: when the loop is no longer triggered by a person with a prompt, but by the system itself.
The practical difference:
- Who starts the work: a person, vs. a trigger (a schedule, an event, an alert, a task queue)
- Who decides the next step: a person, turn by turn, vs. the system, with rules you designed once
- Where progress lives: in the conversation (and gets lost), vs. in external state (files, tickets, a database)
- Who verifies: the person who asked, vs. an automatic verifier (tests, CI, rules) and, for risky actions, a human
- When it stops: when the person gets tired, vs. when the exit criteria, the budget, or the step limit is hit
The 6 parts of a well-designed loop
Every loop that works in practice, in any tool (Claude Code, Codex, your own agents), ends up with these six parts. If one is missing, the loop fails in a predictable way.
1. A trigger, not a person
The loop starts on its own: a cron at 8:00, a monitoring alert, a PR being opened, a ticket entering a queue, a webhook. If someone has to remember to start it, you don't have a loop, you have a habit.
Practical rule: start with boring, predictable triggers (schedule or a clear event), not with "let the agent decide when to work."
2. State outside the conversation
The context window is not a database. A loop that runs for hours or days needs to save its progress somewhere durable: a state file, a table, the very ticket or PR it is working on.
That enables three things the conversation cannot: resuming after a crash, auditing what it did and on which turn, and letting another agent (or a person) continue the work without rebuilding all the context.
3. A verifier that is not the same agent
This is the part people skip the most, and the one that matters the most. If the agent that executes also declares "I'm done," your loop optimizes for saying it is done, not for being done well.
The verifier has to be external and, whenever possible, boring: tests that pass or fail, green CI, a linter, a business rule, a second review against written criteria. The exit condition must be machine-checkable, not the model's opinion.
Without a verifier, a loop does not iterate toward quality. It just iterates faster.
4. Limits on steps, time, and money
A loop without limits is an open expense. Every turn costs tokens, and a stuck agent does not stop on its own: it can repeat the same tool dozens of times, convinced that "this time it will work."
Define these in the design:
- Maximum iterations per task (and what happens when it is hit: escalate, don't keep going)
- Token/cost budget per run and per day
- Repetition detection: if the same action with the same parameters shows up twice in a short window, that is a loop inside the loop, and it gets cut
- A total timeout, just like any other production job
5. A scoped environment and permissions
The loop inherits whatever the agent can touch. That is why the design includes the environment: isolated work (a branch, a worktree, a container), credentials with the least possible scope per task, and tools split between free reads and writes that need approval.
The rule we already apply to any production agent applies twice here, because nobody is watching in real time: guardrails are code, not prompts. Telling it "don't touch production" in the instruction is not a control. Taking away the production credential is. In what nobody tells you about AI agents in production we explain why this layer weighs more than the choice of model.
6. Designed escalation, not improvised
Every loop needs a dignified exit: when it cannot verify, when it hits a limit, when the action is destructive or the cost spikes, the work goes to a person with the state already saved (what it tried, what failed, on which turn).
Escalating is not the loop failing. A loop that escalates well is trustworthy; one that never escalates is a risk waiting for a time of day.
A complete example, without exaggerating
A maintenance loop that actually serves a mid-market team (20–50 people):
- Trigger: every Monday at 7:00, or when CI detects dependencies with vulnerabilities.
- Work: the system creates an isolated branch per repository and hands the agent a scoped task: update minor dependencies, one per PR.
- Verification: the loop does not accept the agent's PR. It runs the full test suite and CI; if something fails, it returns the error to the agent for a second (and at most a third) turn.
- State: each PR records what was updated, which tests ran, and how many turns it took.
- Limits: maximum 3 turns per PR, a fixed daily budget, no major upgrades.
- Escalation: if the tests are still red, the loop stops, leaves the diagnosis written on the PR, and assigns it to a human. It does not insist all week.
None of this requires a multi-agent framework. It requires design, which is exactly the point of Loop Engineering.
When a loop is NOT worth it
Honesty is also part of the design. A loop pays off when three conditions hold:
- The task repeats enough to amortize the design (if it happens once a quarter, do it by hand)
- Verification can be automated (if only an expert human can judge the result, the loop just moves the work to reviewing)
- The cost of a bad turn is low or contained by the limits (if an error is irreversible, the human goes before the action, not after)
If one of the three is missing, a good prompt and a person still win. And that is fine.
There is also a less visible cost: comprehension debt. If the loop produces changes nobody on the team understands, every successful turn makes you more dependent and less able to step in when it fails. That is why state and traces matter: the loop must leave the work readable, not just finished.
How to start this week
You don't need to redesign how you work. Start with one small loop:
- Pick one repetitive task with clear automatic verification (tests, CI, a report that can be validated).
- Write it down the way you would for a new teammate: goal, exact inputs, expected outputs, acceptance criteria. That is your loop design on one page.
- Run the loop with a human approving every turn for the first runs. Watch where it gets stuck: that is where the design is incomplete.
- Automate verification before execution. First the judge, then the autonomy.
- Add limits and external state, and only then let it run on its own, in a bounded schedule.
- Measure two numbers: average turns per task and cost per finished task. If they don't improve in a month, the problem is the design, not the model.
Conclusion
The prompt was the unit of work of the first stage of AI. The loop is the unit of the second: systems that find work, execute it, verify it, and know when to stop or ask for help.
Loop Engineering is not letting agents loose. It is the opposite: putting the engineering effort where it always belonged, in the system around the model. Clear triggers, durable state, an independent verifier, cost limits, and scoped permissions. The model provides the reasoning; the loop provides the reliability.
The teams that do this well won't be the ones with the smartest agent, but the ones that design the most boring, observable, and predictable cycle. Like any other production system.
Need someone to run this?
DevOps retainers with infrastructure monitoring, CI/CD, and clear monthly packages, from $500/mo.
See pricing
Need someone to run this?
DevOps retainers with infrastructure monitoring, CI/CD, and clear monthly packages—from $500/mo.
See pricing