What Is Loop Engineering?
Loop Engineering is the practice of designing the loop around an AI agent: what it reads, who receives the work, how the result is checked, what gets remembered, and when the loop stops or runs again.
Why it matters
A strong prompt can get one useful answer. A strong loop can keep returning to the same kind of work without losing safety, budget, or human judgment. That difference matters once an agent is expected to watch CI, follow review comments, refresh content, clean data, or handle any repeated task.
The four layers
| Layer | What it handles | What breaks when it is missing |
|---|---|---|
| Prompt Engineering | One instruction for one response | The agent has no durable structure |
| Context Engineering | The information inside the current run | The agent works from weak or stale inputs |
| Harness Engineering | Tools, permissions, checks, and guardrails for one run | A single run can act unsafely |
| Loop Engineering | Discovery, handoff, verification, persistence, and scheduling | Repeated work drifts, overspends, or never stops |
The five moves
- 01What does the loop read first?Discovery
- 02Who or what receives the work?Handoff
- 03Who checks the result?Verification
- 04What gets saved for next time?Persistence
- 05When does it run again or stop?Scheduling
Practical checklist
- Name the discovery source: CI, issues, commits, inbox, queue, or saved report
- Define the handoff: which agent works, where it works, and who owns the final decision
- Use a validation step plus an independent checker
- Persist the run note so the next pass has memory
- Set the schedule, stop rule, budget cap, and human approval point
Example
A CI fix loop reads the latest failing run, hands the task to a coding agent in an isolated worktree, runs lint/test/build, asks a separate checker to review the diff, writes a short run note, and stops for human approval before merge.
Common failure modes
Related templates
FAQ
No. Automation can trigger a task. Loop Engineering also defines the handoff, checker, memory, stop rule, budget, and approval point around that task.