Anatomy of a loop
The building blocks that keep turning up in well-designed loops, and the shift from "model → tool → model" to "goal → evidence → evaluation".
The June 2026 essays on loop engineering (Steinberger via Firecrawl, Osmani via AI Builder Club, O'Reilly Radar) disagree on how to count the pieces (five? six?) but agree on what the pieces are. The academic review of the practice found "broad agreement on the building blocks". Here they are.
The building blocks
Trigger: what starts an iteration
A person typing, a schedule, a webhook (a PR comment, a failed CI run), or another loop. The trigger decides whether the loop is interactive (you're watching), asynchronous (you'll look later) or ambient (nobody is looking unless it raises a flag).
Context and skills: what the agent knows when it wakes
Instructions, project conventions, skills (reusable procedures), and the state left by previous runs. A fresh context window that reads well-structured state often beats a long, polluted one. See Context and memory.
Isolation: where it's allowed to act
Git worktrees so parallel agents don't collide, sandboxes and containers so a mistake (or an injected instruction) has a limited blast radius, and tool permissions. Practitioner summaries of Steinberger's setup describe worktrees per agent as a baseline (Firecrawl).
Action: the agent's actual work
The inner tool loop. This is the part people used to focus on, and the part that needs the least design now.
Verification: is the work actually good?
Tests, type checks, builds, a browser clicking through the UI, a second model reviewing the diff. The arXiv study found maker/checker separation (the thing doing the work is not the thing grading it) to be the most emphasized building block. See Maker/checker.
Stop condition and budget: when does it end?
A completion check (deterministic if possible), plus a hard cap on turns, tokens, dollars or wall-clock time as a fallback. Without both, a loop that can't succeed runs until someone notices the bill. See Budgets and lifecycle.
State: what carries over
Progress files, feature lists, git commits, structured JSON, a session log outside the harness. This is how iteration 40 knows what iteration 39 did, and how a crashed loop resumes. Anthropic's Managed Agents post keeps the session log outside the harness for this reason: nothing in the harness has to survive a crash.
From "model → tool" to "goal → evidence"
The older mental model of an agent is a chain:
The 2026 mental model of a loop is a cycle where each pass has to produce evidence that something improved:
The difference is more than cosmetic. In the first model, the model's own judgment is the only thing deciding whether to continue. In the second, there's a goal outside the model, evidence that can be checked without trusting the model's word, and an explicit state transition that the next iteration builds on.
This is why the Goals section of this guide exists. Once you design loops this way, the goal stops being a prompt and becomes a control object with acceptance criteria, a judge, a budget and a lifecycle.
A worked example: Anthropic's long-running harness
Anthropic's Effective harnesses for long-running agents (late 2025) is the clearest public example of these blocks working together. The problem it addresses is that long tasks span many context windows, and "each new session begins with no memory of what came before."
| Building block | How the harness implements it |
|---|---|
| Trigger | An initializer agent runs once to set up the environment; a coding agent is invoked repeatedly after that. |
| Context | A feature list, a progress file and git history, all written for the next session to read. |
| Action | Each coding session works on a small increment rather than trying to do everything. |
| Verification | Features are marked done only after they are tested. |
| State | Progress file and commits form the handoff between sessions. |
Several commentators note the "two agents" are the same model under different prompts (ZenML summary, Beri). What matters is the structure, not the number of models.
The follow-up, Harness design for long-running apps (March 2026), adds a planner that writes detailed specs (without it, the generator under-scoped) and an evaluator that tests the running app with Playwright instead of just reading code. Before each chunk of work, generator and evaluator agree on a "sprint contract" defining what done means. That is a goal with acceptance criteria, negotiated in advance. See Writing goals.
Further reading
- Loop Engineering: Building Blocks, Adoption, and Impact (also as PDF): the academic review.
- Designing Loops: A Practitioner's Short Field Guide
- The Anatomy of an Agent Loop by Steve Kinney
- You Could've Invented Claude Code
- Agent Harnesses with Claude: Intuitively and Exhaustively Explained
- The Agentic Loop: A Practical Field Guide on DEV