Loop Engineering: The Skill That Comes After Prompt Engineering

For three years, the headline AI skill was prompt engineering. Phrase your request the right way, add a few examples, and you got a better answer. In June 2026 a new phrase started showing up in the same conversations: loop engineering. It is not a rebrand of prompting. It is the next layer up, and it changes what "using AI well" even means.
Here is the short version. You stop writing prompts. You start designing the system that writes the prompts for you, runs the agent, checks the work, and runs it again until the job is actually done. This guide explains the shift in plain terms, gives you the vocabulary, and shows you a concrete everyday example you can picture without writing a line of code.
Where loop engineering came from
The term was popularized in June 2026 by Addy Osmani, an engineering lead at Google Chrome, in an essay that named and structured a practice other people had been describing in pieces. He synthesized ideas from Boris Cherny, the creator of Claude Code at Anthropic, and Peter Steinberger, the creator of OpenClaw, one of the fastest-growing open-source AI agents ever built.
The line that captured it came from Cherny: "I don't prompt Claude anymore. I have loops that are running. They're the ones prompting Claude and figuring out what to do." Steinberger framed the same idea as a job change: you should be designing the loops that prompt your agents, not prompting the agents yourself. He built OpenClaw largely by running fleets of agents in loops rather than writing the code by hand, which is what gives the point its weight.
It caught on because the underlying models finally got good enough. By mid-2026, agents could run on their own for long enough, and recover from their own mistakes well enough, that the bottleneck moved. The hard part was no longer wording a single request. It was designing the system the agent runs inside.
The three layers: prompt, context, loop
The cleanest way to see the shift is as a layered progression. Each layer builds on the one below it.
- Prompt engineering (2022 to 2024). The craft of a single turn: wording, phrasing, examples, tone. You are tuning one question to get one good answer.
- Context engineering (2025). Giving the model everything it needs to plausibly solve the task: the right documents, the right history, the right tools in reach. Less about phrasing, more about what is in the window. If you want a refresher on why the window matters, see our explainer on how context windows work.
- Loop and harness engineering (2026). Designing the iterative cycle and the scaffolding the agent runs inside: the tools it can call, the constraints it works under, the feedback that tells it whether it is done.
The mental shift between layer one and layer three is the whole story. Prompt engineering asks, "What should I say to get the best output?" Loop engineering asks, "What system should I build so the agent finds the work, does it, verifies it, and remembers it, without me in the loop at all?"
From the response to the trajectory
There is one idea worth slowing down on, because it reframes everything else.
In prompt engineering, the unit of value is the response. You want one good answer, and you judge the prompt by that answer. In loop engineering, the unit of value is the trajectory, the whole run from start to finish.
That difference matters more than it sounds. In a good loop, a mistake on turn one does not ruin the result. The system notices the problem, runs a test, sees the failure, and fixes it by turn four. You stop trying to get the first answer perfect and start building a process that converges on a good answer even when early steps are wrong. You are no longer grading a sentence. You are designing a process that self-corrects.
The five parts of a loop
Most useful agent loops have the same five parts. Learn these five words and you have the working vocabulary.
- Trigger. What starts the loop. It can be a schedule (every weekday at 8am), an event (a pull request opens, a test fails, an email arrives), or a plain human instruction.
- Goal. A verifiable end state, not a vague aspiration. "All tests pass," "zero open high-priority issues," "the bundle is under 200KB." If you cannot check it, the loop cannot know when to stop.
- Actions. The tools the agent is allowed to use: reading and writing files, running commands, calling APIs or connecting to outside systems. Actions are the agent's hands.
- Verification. How the loop knows it is actually done. Run the tests and check the result, have a second model review the work, wait for a build to pass. Prefer a deterministic check (a test that passes or fails) over asking the model to grade itself.
- Memory. What persists across iterations: notes files, logs, project context. Memory is what lets a loop learn instead of repeating the same mistake every run.
A quick illustration of the cycle in pseudo-steps, just so the shape is concrete:
while goal not met:
decide next action
do the action # an "action" from your toolset
observe the result # output, errors, exit codes
record what happened # write to memory
if verified done: stop
if out of budget or tries: stop and hand back to human
Notice there is no single prompt in there. You set the goal and the exits. The loop does the iterating.
Types of loops
Loops differ mostly by what triggers them. Four common shapes:
- Heartbeat loops run continuously on a short interval, always checking whether there is something to do.
- Cron loops run on a fixed schedule, like a daily 8am job.
- Hook loops are event-triggered, like a loop that fires whenever a build fails.
- Goal loops iterate until a success condition is met, then stop. These are the ones you reach for when you have a clear finish line.
Loop patterns worth knowing
A handful of named patterns show up again and again. You do not need to implement them to recognize them.
- ReAct. The agent reasons about what to do, takes an action, then observes the result before reasoning again. Reason, act, observe, repeat.
- Reflexion. The agent critiques its own attempt and writes down the lesson, so the next iteration is better informed.
- Plan-and-Execute. The agent makes a plan first, then carries it out step by step, rather than improvising every move.
- Evaluator-Optimizer. One model generates a result, a second model grades it, and the loop repeats until the grader is satisfied.
If these sound familiar, it is because they grew out of agentic workflows where LLMs reason, act, and collaborate, and out of older ideas like prompt chaining for multi-step workflows. Loop engineering is what you get when you wrap those patterns in a trigger, a goal, and a verification step and let them run on their own.
A concrete everyday example: the morning triage loop
Theory gets real fast with an example, so here is one you can picture even if you have never built an agent.
Imagine a team drowning in incoming issues every morning. A loop can own that.
- Trigger: every weekday at 8am.
- Goal: every high-priority issue has an owner and a plan.
- Actions: read the new issues, post a comment summarizing each one, apply labels.
- Verification: zero unassigned high-priority issues remain.
- Memory: a weekly triage log, so the loop learns which issues recur and who usually handles them.
You set this up once. After that it runs each morning on its own. Nobody types a prompt. The value is not any single comment the agent writes. It is that the team walks in to a triaged board every day. That is the trajectory mindset in action.
How loops break, and how to design against it
Autonomous loops fail in predictable ways. Knowing the failure modes is most of the skill.
- Context overflow. The agent accumulates so much history that it runs out of room. Fix it by summarizing, pruning, or moving state into external memory.
- No-progress loops. The agent circles the same step without advancing. Fix it by capping the number of iterations and detecting when it is repeating itself.
- Objective misspecification. The goal was vague, so the agent optimizes the wrong thing. Fix it by making the goal verifiable.
- Hallucinated success. The agent reports that it finished when it did not. This is why you verify with an independent check rather than trusting the agent's own self-report.
- Cost blowup. Left unbounded, a loop can burn through a lot of tokens. Fix it with a budget.
The single most important design rule that comes out of this list: a good loop has multiple independent exits. A verifier that confirms the goal, a hard cap on iterations, and a budget. If any one of them trips, the loop stops. You never want a system whose only way to end is to succeed.
What this means for you
You do not need to be a software engineer to use this mental model. If you automate anything repetitive, you are already thinking in loops, you just have not named the parts. The shift is to stop asking "what is the perfect prompt" and start asking "what triggers this, what is the goal, what can it do, how do I verify it, and what should it remember."
If you want to go from the idea to building one, a few free, hands-on paths fit naturally:
- Agentic AI with Python and LangChain to build loops in Python.
- Building AI Agents with Node.js and TypeScript if you live in the JavaScript world.
- The Model Context Protocol (MCP) to give your loops standardized tools and context to work with.
Key takeaways
- Loop engineering is designing the system that prompts, checks, remembers, and reruns an agent, instead of prompting it by hand.
- It is the third layer in a progression: prompt engineering, then context engineering, then loop and harness engineering.
- The unit of value moves from a single good response to the quality of the whole trajectory.
- Every loop has five parts: a trigger, a verifiable goal, actions, verification, and memory.
- Loops come in heartbeat, cron, hook, and goal shapes, and lean on patterns like ReAct, Reflexion, Plan-and-Execute, and Evaluator-Optimizer.
- Good loops defend against failure with multiple independent exits: a verifier, a hard iteration cap, and a budget.
Ready to build your first one? Start with Agentic AI with Python and LangChain, free and self-paced, and turn the mental model in this article into a loop that actually runs.
Liked this article?
Get the weekly AI digest
New free courses, the latest from the blog, and practical AI tips.
Free forever. Unsubscribe anytime.
Related articles

Agentic Workflows Explained: How LLMs Reason and Act
Agentic workflows let LLMs reason, act, and collaborate autonomously. Learn how they work, key patterns, and how to build your first one in 2026.

What Is Prompt Chaining? How to Build Multi-Step AI Workflows
Learn what prompt chaining is and how to build multi-step AI workflows. Practical examples with ChatGPT and Claude to automate complex tasks step by step.

LLM Context Windows Explained: AI Memory in 2026
What is an LLM context window? Compare GPT, Claude, and Gemini context sizes in 2026, learn how tokens work, and discover when bigger isn't better.

