# Loop engineering

The practice of improving the complete perceive–decide–act–observe cycle around a model rather than optimizing prompts in isolation.

technical-term · Harness & runtime · practitioner · Reviewed 2026-08-09

## Definition

Loop engineering designs context construction, tool contracts, state, environment feedback, validations, retries, memory updates, budgets, and terminal dispositions as one measurable runtime system. It is a useful practitioner label for a subset of harness engineering centered on the repeated decision cycle.

The underlying runtime practices are established; “loop engineering” remains an emerging practitioner label.

## Why it matters

A stronger model increases leverage on the loop it inhabits; it does not repair a weak environment, ambiguous state, or missing feedback by itself.

Changes should be evaluated at the outcome and trajectory level.

## System anatomy

- **Context cycle:** Select the right evidence for each step.
- **Action cycle:** Propose, validate, execute, and observe tools.
- **Learning cycle:** Turn failures and corrections into evals or governed memory.
- **Termination cycle:** Finish, correct, hold, escalate, or stop.



## Important distinctions

- **Prompt engineering:** Prompt engineering shapes one model interaction; loop engineering shapes repeated interactions and their environment.
- **Harness engineering:** Loop engineering focuses on the runtime cycle; harness engineering also covers repository, workspace, delivery, and organizational feedback surfaces.



## Implementation signals

- Improve the bottleneck exposed by traces and evals
- Require state change or new evidence before retries
- Keep terminal decisions finite and inspectable

## Failure modes

- The loop produces more tokens without better outcomes
- Self-critique is mistaken for independent acceptance



## Related knowledge

- [Agent loop](https://aisdlc.ai/agentic-engineering/agent-loop) — The finite runtime cycle in which an agent interprets state, selects an action, observes the result, updates state, and decides what happens next.
- [Harness engineering](https://aisdlc.ai/agentic-engineering/harness-engineering) — Engineering the agent loop, task decomposition, tools, permissions, session state, checks, retries, feedback, checkpoints, and stop conditions that surround a model.
- [Eval-driven development](https://aisdlc.ai/agentic-engineering/eval-driven-development) — An engineering loop that converts expected behavior and observed failures into repeatable evaluations combining deterministic checks, environment inspection, security testing, model graders, repeated trials, and human judgment.
- [Reflection](https://aisdlc.ai/agentic-engineering/reflection) — A feedback pattern in which a model critiques an attempt and records lessons or a revised approach for another attempt.

## Sources and further study

- [Peter Yang — 5 Rules for Building AI Agents That Work in Production | Nan Yu & Jacob Shumway](https://www.youtube.com/watch?v=4mKtJzfGj0U) — A Linear engineering discussion of production agents, tool design, context loading, feedback, evaluation, and simple model-in-a-loop explanations. **Use:** Practitioner perspective. **Limitation:** The five rules and “LLM in a loop plus tools” shorthand reflect one product team’s experience; they are not a standard or a complete enterprise-agent definition.
- [AI Engineer — Harness Engineering: How to Build Software When Humans Steer, Agents Execute — Ryan Lopopolo, OpenAI](https://www.youtube.com/watch?v=am_oeAoUhew) — A conference presentation about engineering repositories, feedback loops, tools, and constraints around coding agents. **Use:** Practitioner perspective. **Limitation:** The talk reports a first-party approach and should be paired with the cited OpenAI engineering article; it is not a universal method or independent assurance evidence.
- [OpenAI — Harness engineering: leveraging Codex in an agent-first world](https://openai.com/index/harness-engineering/) — A production case study in designing repositories, tools, feedback loops, and environments for agent-first delivery. **Use:** First-party case study. **Limitation:** This first-party account documents one organization, product, or implementation context and should not be generalized without local evidence.
- [Anthropic — Harness design for long-running application development](https://www.anthropic.com/engineering/harness-design-long-running-apps) — A planner, generator, and evaluator architecture for multi-hour autonomous application development. **Use:** First-party case study. **Limitation:** This first-party account documents one organization, product, or implementation context and should not be generalized without local evidence.

---

This library synthesizes cited research, standards, official documentation, and clearly attributed practitioner perspectives. Maturity describes the state of a concept—not vendor endorsement, production readiness, or permission to deploy. Benchmarks and demonstrations do not replace use-case evaluation, governed controls, independent verification, or named human release authority.
