Loop engineering is the practice of designing workflows in which an AI agent pursues a goal across repeated cycles — planning, acting, checking its work against an external verifier, and feeding failures back in — rather than answering a single one-shot prompt.
The pattern replaces manual prompt-and-response with a bounded, self-correcting process: the human defines the objective and constraints once, and the agent iterates until a stop condition is met. Three elements make a loop reliable — a verifier (automated tests, metrics, or builds the agent cannot grade itself), persistent state that records attempts and next steps so work resumes rather than restarts, and explicit stop conditions tied to the goal or a token budget. The practice became prominent through 📝Andrej Karpathy, whose AutoResearch experiments applied it to machine-learning research and are detailed in 📝Karpathy Loop Engineering; it sits alongside 📝Agentic Coding as a core skill of directing agents with discipline. Loop engineering earns its overhead only on repeated, measurable work with real tool integration; for one-off tasks it costs more than it returns.
