What Is Loop Engineering?
Loop engineering is the practice of designing the system that prompts an AI agent — on a schedule or in response to a trigger — instead of typing every prompt by hand. Your job stops being "write a good prompt" and becomes "design a process that finds the work, prompts the agent, checks the result, and decides what to do next."
This content was developed with AI assistance and is regularly reviewed for accuracy.
Learning Focus
By the end of this guide, you'll understand:
- What loop engineering is and why it emerged in 2026
- How it relates to prompt engineering and context engineering
- When a loop is the right tool — and when it isn't
The shift: from holding the tool to building the loop
For roughly two years, working with an AI coding agent looked like this: you wrote a careful prompt, read what came back, then wrote the next prompt. The agent was a tool, and you were holding it the entire time — one turn after another.
By mid-2026, agents could run multi-step work on their own for long stretches. So the valuable skill moved up a level. Instead of being the person who prompts the agent, you design the system that prompts it for you: something that finds the next task, hands it to the agent, checks whether the result is acceptable, writes down what happened, and then decides the next move.
The term was popularized in June 2026 by Addy Osmani, building on observations from Peter Steinberger and Anthropic's Boris Cherny, who leads Claude Code. Cherny summarized the change directly:
"I don't prompt Claude anymore. I have loops running that prompt Claude and figuring out what to do. My job is to write loops."
That sentence is the whole idea. The agent is no longer something you hold turn by turn — it's a process you start and supervise.
Prompt → Context → Loop
Loop engineering didn't replace the earlier skills; it wraps them. Think of three layers that build on each other:
| Layer | The question it answers | Example |
|---|---|---|
| Prompt engineering | What do I ask? | "Write a function that validates email addresses, with tests." |
| Context engineering | What does the model need to know? | Giving it the codebase, the style guide, and the failing test output. |
| Loop engineering | Who decides what to ask, when, and whether the answer is good enough? | A system that pulls the next ticket, prompts the agent, runs the tests, and retries or escalates. |
A loop still contains prompts, and it still needs good context. The new part is the control system around them: the scheduling, the evaluation, and the decision about what happens next.
What a loop actually does
Strip away the jargon and every loop runs the same five-beat cycle:
- Find the work — pull the next task from a queue, an inbox, a schedule, or a trigger.
- Do the work — prompt the agent with the task and the right context.
- Check the work — run tests, score against a rubric, or verify against a goal.
- Record what happened — log the result so the next iteration (and you) can see it.
- Decide what's next — stop, retry, escalate to a human, or pick up the next task.
The next guide, Anatomy of an Agent Loop, breaks these beats into the concrete components you'll actually build.
When a loop is the right tool
Loops shine when work is repetitive, verifiable, and shouldn't require you to sit there:
- A queue of small, well-defined coding tasks that each have tests
- Monitoring something on a schedule and producing a digest
- Triaging incoming items (tickets, emails, alerts) against clear rules
- Any "do this every night / every hour" job you'd otherwise do by hand
When a loop is the wrong tool
Be honest about this — most of the failures people hit come from looping work that shouldn't be looped:
- One-off tasks. If you'll do it once, just prompt the agent directly. Building a loop is overhead.
- Work with no way to check the result. If you can't verify success automatically (or with a quick human glance), the loop can't tell good output from bad — it'll confidently repeat mistakes.
- High-stakes, irreversible actions. Sending money, deleting data, emailing customers — keep a human in the loop (literally) before these happen.
- Fuzzy goals. If you can't describe "done," the loop can't decide when to stop.
A good rule of thumb: if you can't write the stop condition and the success check, you're not ready to write the loop yet.
Key Takeaways
- Loop engineering means designing the system that prompts the agent, not prompting it yourself.
- It's the successor to prompt and context engineering — and it wraps both inside an autonomous process.
- Every loop follows the same cycle: find work → do it → check it → record it → decide what's next.
- Loops fit repetitive, verifiable, unattended work; they're a poor fit for one-offs, unverifiable output, and irreversible actions.
- If you can't state the stop condition and the success check, hold off on building the loop.
Next Steps
Continue to: Anatomy of an Agent Loop to learn the six components every reliable loop needs.