What Is Loop Engineering?

Loop engineering is the practice of designing AI systems that don't just respond once — they act, observe the result, decide what to do next, and repeat until the goal is actually met. Instead of you typing each prompt by hand, you build the system that prompts the agent, checks its own work, and keeps going until a success condition is satisfied.

Prompt engineering optimizes a single instruction, one turn at a time. Loop engineering optimizes the autonomous system that decides what to prompt, when to prompt it, and whether the result is acceptable. The unit of work changed from "the message" to "the loop."

The one-line definition: Prompt engineering = writing the best single instruction. Loop engineering = designing the system that writes, runs and evaluates instructions on its own, on repeat, until it's done.

Why It Emerged Now

This isn't hype for hype's sake — it tracks a real capability jump. By mid-2026, frontier models became reliable enough to stay coherent across long, multi-step tasks: large refactors, deep research, codebase migrations that run for hours. The new Mythos-class models with persistent file-based memory pushed this even further.

Once agents can run that long, model capability stops being the bottleneck. Orchestration design becomes the bottleneck. A brilliant model in a sloppy loop wanders, repeats itself, or quits early. A merely good model in a well-designed loop ships. That gap is what loop engineering closes.

As Boris Cherny put it: prompt engineering isn't dead — it's table stakes. Loop engineering is the next layer on top.

The 4 Types of Loops

Most production agent systems are built from four basic loop patterns. Knowing which one a task needs is half the skill.

💓
Heartbeat loop
Runs continuously on a short interval. Good for monitoring, polling a queue, or watching for changes — "every 30 seconds, check and react."
🕒
Cron loop
Scheduled at specific times — "every day at 10am, summarize yesterday's tickets." Predictable, recurring, calendar-driven work.
🪝
Hook loop
Triggered by an event — a PR push, a CI failure, a new email. The agent wakes up only when something happens, then acts.
🎯
Goal loop
Iterates until a success condition is met, then stops — "keep fixing until all tests pass." The workhorse of autonomous coding agents.

The Anatomy of a Good Loop

Whatever the type, a well-engineered loop has the same four parts. Get any one wrong and the agent misbehaves:

  1. Act — the agent takes a step (writes code, calls a tool, drafts a section).
  2. Observe — it captures the result and any feedback (test output, error, validator score).
  3. Evaluate — it judges whether the result is good enough against an explicit success condition.
  4. Decide — continue, retry differently, escalate to a stronger model, or stop.
Goal: All tests in /tests pass and lint is clean. Loop: 1. Run the test suite and capture failures. 2. If failures: pick the highest-signal one, fix it, re-run. 3. If a fix fails twice the same way: escalate to a stronger model. 4. Stop when tests pass AND lint is clean — or after 12 iterations. Guardrails: never edit files outside /src. Report what changed each round.

Notice what the example specifies that a normal prompt wouldn't: a measurable stop condition, an escalation rule, an iteration cap, and guardrails. That's the loop-engineering mindset — you're not writing instructions, you're designing a control system.

Prompt Engineering vs. Loop Engineering

DimensionPrompt EngineeringLoop Engineering
Unit of workOne messageOne autonomous loop
Who decides next stepYouThe system
Time horizonSecondsMinutes to hours
Key skillWording & structureStop conditions, evaluation, guardrails
Failure modeBad answerInfinite loop, drift, runaway cost
The new failure modes are expensive. A bad prompt wastes one response. A bad loop can run for hours, burn thousands of tokens, and confidently "finish" the wrong task. Always set an iteration cap, a cost ceiling, and a concrete success condition before you let a loop run unattended.

How to Start (Without Building a Framework)

Prompt engineering still matters. Every loop is made of prompts — the act prompt, the evaluation prompt, the escalation prompt. Loop engineering doesn't replace good prompting; it stacks on top of it. The teams winning at loops are the ones who already nailed the fundamentals. Brush up with our prompt engineering guide.

The Bottom Line

Loop engineering is what prompt engineering grows into when models get good enough to work unsupervised. The job shifts from crafting the perfect sentence to designing the perfect feedback loop: clear goal, honest self-evaluation, smart escalation, hard guardrails. The prompts inside the loop still have to be sharp — but the leverage now lives in the loop around them.

Your loop prompts deserve a real home

Act prompts, evaluation prompts, escalation prompts — the building blocks of every loop. PromptChief keeps them versioned and reusable in one library, so you iterate on your loops instead of rewriting them.

Try PromptChief Free →