Operating system

Loop engineering

Loop engineering is the layer above prompt engineering, context engineering, and harness engineering: designing how an agent keeps working, checks evidence, spends budget, and stops.

Abstract AI agent control system with budget, verifier, and stop gates

Definition

Loop engineering is the practice of designing the system around an AI agent: what triggers it, what goal it pursues, what evidence it checks, how much budget it can spend, when it stops, and when a human must approve the output.

The agent-work stack

LayerWhat it controlsExample
Prompt engineeringThe instructionRefactor this file.
Context engineeringWhat the agent knowsRepo docs, tests, logs, source notes, product constraints.
Harness engineeringWhat the agent can doShell, browser, CI, PR creation, file tools, retrieval.
Loop engineeringWhen it keeps going and when it stopsRun tests, fix failures, repeat until green, blocked, or approval is required.

See the AI Loop Stack

Minimal loop spec

FieldQuestion
GoalWhat should be true when the loop is done?
InputsWhat source of truth can it inspect?
ActionsWhat can it change?
VerifierWhat evidence decides success or failure?
BudgetHow many turns, dollars, files, or minutes can it spend?
Approval boundaryWhat must never publish, send, delete, or spend without a human?

Common failure modes

Questions

FAQ

What is loop engineering?

Loop engineering is designing the operating cycle around an AI agent: trigger, goal, repeated action, verifier, stop condition, budget, and approval boundary.

Is loop engineering different from prompt engineering?

Yes. Prompt engineering shapes one instruction. Loop engineering shapes repeated work and the control system around it.

What is the most important part of a loop?

The verifier and stop condition. Without them, the loop can keep producing work that looks active but is not converging.