A comprehensive guide to building reliable recurring AI-agent systems with 874 curated resources, 22 operational patterns, 22 schema-checked contracts, and 8 runtime starters. The field guide helps teams design, implement, and govern autonomous agents that can discover work, verify results, persist state, and repeat without human intervention.
π Build reliable recurring AI-agent systems: 874 resources, 22 operational patterns, 22 loop contracts, 8 runtime starters, an interactive atlas, and a structured dataset.
README
Loop Engineering is the operating layer for recurring AI-agent work. It defines how work enters, what an agent may do, which external evidence proves completion, what state survives, and whether the system retries, reports, escalates, or exits.
This field guide connects 874 papers, docs, tools, benchmarks, and guides to 22 operational patterns, 22 schema-checked contracts, and 8 runtime starters, so a recurring job can move from evidence to a reviewable implementation.
The reliability gap: prompts, context, and harnesses can improve one run; recurring work also needs explicit triggers, verification, durable state, bounded budgets, and human handoff. Software event loops, control theory, growth loops, generic automation, and one-off prompting are outside this map.
Start In 60 Seconds
Contents
- Implementation Kit
- Mental Model
- Reading Paths
- Choose Your Loop
- Working Definition
- Concept Guides
- How To Judge Each Source
- Resource Type Legend
- Start Here
- What Counts As Loop Engineering
- The Loop Contract
- Loop Design Checklist
- Loop Maturity Model
- Pattern Library
- Core Loop Primitives
- Official Runtime Guides
- Research Foundations
- Model-Level Recurrence
- Agent Workflow Patterns
- Coding-Agent Loop Systems
- Verification And Feedback Gates
- Securing Unattended Loops
- State, Memory, And Context Persistence
- Orchestration And Multi-Agent Delegation
- Benchmarks And Evaluation
- Operations Playbooks
- Templates And Patterns
- Examples And Schema
- Community Gallery
- Critiques, Risks, And Limitations
- Future Directions
- Adjacent Awesome Lists
- Explore And Reuse
- Shape What Comes Next
- Build From This
- Citation
- Star History
Implementation Kit
Move from evidence to implementation through four connected layers:
| Start with | What it gives you | Use it to | Example |
|---|---|---|---|
| π 874 resources | Papers, official docs, tools, benchmarks, and critiques with publication and evidence fields | Understand the design space and open the original work behind a claim | Compare verification methods in the Resource Atlas |
| π§© 22 operational patterns | Symptom-first playbooks with roles, gates, state, budgets, escalation, and worked scenarios | Choose how a recurring job should operate | "CI keeps failing" becomes a CI repair loop |
| π§Ύ 22 schema-checked contracts | One schema-valid JSON specification for every pattern | Make permissions, evidence, limits, and human handoff reviewable | Adapt the CI repair contract to your repository |
| βΆοΈ 8 runtime starters | 3 dependency-light executables plus 5 copy/paste runtime templates | Wire a contract to a session, schedule, CI event, or durable worker | Start with test repair, threshold monitoring, or queue processing |
Fastest build path: name the recurring symptom, inspect its pattern, adapt the linked contract, then choose a runtime for the required persistence, isolation, and permissions.
Browse the interactive Resource Atlas, query the structured dataset, or use one of 8 language entry points.
See it end to end: the four worked paths cover CI repair, knowledge-base refresh, bounded queue processing, and read-only threshold monitoring, including commands and verifiable completion signals.
Two-minute dry run: clone the repository and inspect a bounded queue item without an agent account or extra dependency.
git clone https://github.com/ChaoYue0307/awesome-loop-engineering.git
cd awesome-loop-engineering
printf '%s\n' '{"id":"demo","objective":"Validate one queue item"}' > /tmp/loop-queue.jsonl
python3 examples/runnable/queue-worker-loop.py --queue /tmp/loop-queue.jsonl --dry-run
Mental Model
Prompt engineering asks: what should I say to the model?
Context engineering asks: what state and knowledge should the model see?
Harness engineering asks: what tools, permissions, tests, sandboxes, and feedback should surround the agent?
Loop engineering asks: what recurring system should discover work, delegate to agents, verify results, persist state, decide next actions, and re-run when the human is no longer in the inner loop?
Prompt, context, and harness engineering make one agent run better. Loop Engineering makes agent work repeatable, observable, and governable over time.
Loop shape:
Objective
-> Trigger / cadence
-> Discover / intake work
-> Delegate to agents
-> Act in an isolated workspace
-> Verify with tests, evals, traces, or reviewers
-> if failed: feed back the evidence and retry
-> if passed: persist state and decide what happens next
-> Repeat, report, open a PR, or escalate to a human
Reading Paths
Choose a goal before opening the full catalog. Learn the field through the definition and research foundations; build through a pattern, contract, and runtime; or review reliability through verification, state, security, benchmarks, and critiques.
For analysis, the Hugging Face dataset exposes collection, lifecycle, audience, evidence, source-status, publication, and repository-stat facets for every resource.
Fastest conceptual path: read the Working Definition, inspect the Loop Contract, choose a symptom in the Pattern Library, and follow a worked implementation.
Choose Your Loop
Choosing a loop means choosing the operating policy around an agent, not the model itself. A pull-request loop, deploy loop, and adversarial-testing loop may use the same model, but they need different triggers, permissions, evidence gates, durable state, retry budgets, and human owners. Those controls decide what the agent may do, what counts as success, what the next run can remember, and when automation must stop.
A generic "keep trying" loop collapses those differences. It can retry a judgment call, let the acting model approve its own work, lose evidence between runs, or change a high-risk system when it should only observe and escalate. A named pattern supplies a reviewable starting policy for a recurring job; its contract makes that policy exact for your environment.
First Decide Whether The Work Should Loop
| Use a loop when... | Prefer one supervised run when... |
|---|---|
| Work returns through a schedule, event, queue, or recurring condition. | The task is genuinely one-off. |
| An external check can prove progress or completion. | "Done" depends mainly on open-ended human judgment. |
| Saved evidence, checkpoints, or receipts improve the next run. | No useful state should survive the session. |
| Permissions, retries, time, and cost can be bounded in advance. | A safe permission or budget boundary cannot be stated. |
| A named human owns ambiguity, exceptions, and high-impact decisions. | Every meaningful step already needs live human direction. |
Choose In Four Decisions
| Decision | Ask | What it fixes |
|---|---|---|
| 1. Name the recurring job | What signal keeps returning, and what outcome should improve? | Objective, trigger, and intake |
| 2. Define proof | What evidence can a reviewer or machine inspect to decide "pass"? | Verification gate and exit condition |
| 3. Bound action | What may the agent read or change, and what must it never do? | Workspace, permissions, non-goals, and budget |
| 4. Plan the next pass | What should persist, retry, escalate, or stop after each result? | Durable state, handoff, and next action |
Select the pattern for the class of work, adapt its contract to your exact controls, then choose the runtime based on persistence, isolation, and permissions. Start from the problem and its verified finish below, or compare every field in the pattern matrix.
| When you say... | Start with | The loop can finish when... |
|---|---|---|
| "My PR is stuck" | PR babysitter | Required checks pass, review threads are resolved, and merge state is current. |
| "CI keeps failing" | CI repair loop | The original failing command passes with a scoped patch. |
| "The docs may be stale" | Docs drift collector | Verified code/docs mismatches are patched and examples still run. |
| "A deploy needs monitoring" | Deploy verifier | Synthetic checks and rollout thresholds remain within policy. |
| "Feedback is noisy" | Feedback clusterer | Themes cite source items and separate frequency from severity. |
| "Dependency updates pile up" | Dependency triage loop | Safe updates pass tests and risky upgrades have an owner-backed escalation. |
| "Agent evals regressed" | Evaluation regression loop | Targeted evals return to the accepted baseline without scorer changes. |
| "Sensitive changes need review" | Security review loop | Findings cite concrete evidence and approval boundaries stay intact. |
| "Agent spend is rising" | Cost-control loop | Spend falls on a comparable workload without quality regression. |
| "I need recurring bug discovery" | Bug hunting loop | Every accepted finding has reproducible steps or a failing test. |
| "A change needs sign-off" | Enterprise approval loop | Every required gate has a recorded decision and audit trail. |
| "An incident just paged" | Incident response loop | Impact, evidence, timeline, and accountable owner are recorded. |
| "A dataset keeps drifting" | Data-quality loop | Hard quality rules pass before a new version is promoted. |
| "Release notes are a chore" | Release-note loop | Every shipped change maps to a merged source and audience-facing note. |
| "Model choice is ad hoc" | Model-routing loop | Routing meets quality, latency, privacy, and cost tolerances. |
| "A stable system should improve" | Benchmark optimization loop | Repeated measurements confirm improvement with protected metrics intact. |
| "The agent's knowledge is stale" | Knowledge freshness loop | A versioned corpus passes provenance, freshness, retrieval, and leakage gates. |
| "Runs repeat mistakes they already made" | Agent memory lifecycle loop | Governed memory records pass provenance, scope, and recall gates between runs. |
| "Parallel agents collide on one repo" | Fleet coordination loop | Isolated workers land serially through a verified merge queue. |
| "Performance regressed" | Performance regression loop | A controlled benchmark confirms recovery with correctness intact. |
| "A UI accessibility check failed" | Accessibility regression loop | The exact regression is fixed and required human criteria are approved. |
| "The agent needs adversarial testing" | Adversarial red-team loop | Findings are reproduced, minimized, privately reported, and regression-tested. |
After choosing the pattern, compare runtime persistence, isolation, permissions, and escalation.
Working Definition
Loop Engineering is the AI and coding-agent practice of designing recurring systems that discover work, delegate it to agents, verify results, persist state, decide next actions, and run again on a cadence, event, or until a verifiable goal is reached.
Concept Guides
These vendor-neutral guides define the concept, boundaries, vocabulary, and reviewable artifacts.
| Resource | Published at | Contribution | Evidence |
|---|---|---|---|
| π§Ύ Working DefinitionTemplate | 2026 Β· GitHubProject documentation | Short definition, positioning, minimal loop test, and citation note. | Project artifact |
| π§Ύ Loop Engineering ManifestoTemplate | 2026 Β· GitHubProject documentation | Concise statement of the concept, commitments, non-goals, and success standard. | Project artifact |
| π§Ύ Loop Engineering TaxonomyTemplate | 2026 Β· GitHubProject documentation | Classification by trigger, intake, verification, state model, topology, and operating domain. | Project artifact |
| β οΈ Loop Engineering Anti-PatternsCritique | 2026 Β· GitHubProject documentation | Common failure modes such as prompt loops with no contract, infinite retries, model self-approval, hidden state, and unsafe autonomy. | Project artifact |
| π§Ύ Comparison GuideTemplate | 2026 Β· GitHubProject documentation | Distinguishes Loop Engineering from prompt engineering, context engineering, harness engineering, workflow automation, agent workflows, and evaluation loops. | Project artifact |
| π§Ύ Sourced Signals And QuotesTemplate | 2026 Β· GitHubProject documentation | Short sourced signals from linked public materials that anchor the emerging concept. | Project artifact |
| π§Ύ Outreach KitTemplate | 2026 Β· GitHubProject operations guide | Conservative messages for inviting corrections, sources, and real-world loop patterns. | Project artifact |
How To Judge Each Source
Open the original work before relying on a summary. Use the contribution, novelty, impact, and evidence fields to compare approaches and understand what supports each entry.
Resource Type Legend
| Type | Rows | Includes |
|---|---|---|
| π Paper | 375 | Academic paper, preprint, or technical report |
| π Blog | 114 | Essay, field note, article, or practitioner write-up |
| π Docs | 83 | Official product, API, SDK, or platform documentation |
| π§° Tool | 144 | Repository, framework, SDK, runtime, or implementation |
| π§ͺ Benchmark | 67 | Benchmark, eval suite, leaderboard, or evaluation dataset |
| π Pattern | 37 | Operational playbook or reusable workflow |
| π§Ύ Template | 25 | Template, checklist, schema, guide, or contribution artifact |
| π§ List | 17 | Adjacent directory, ecosystem map, or reading list |
| β οΈ Critique | 12 | Risk analysis, limitation, caveat, or skeptical take |
Every row shows the work and type, its original publishing platform or venue, the contribution that matters for Loop Engineering, and a plain-language evidence label. Author lists are shortened for scanning; the queryable dataset exports and Resource Atlas retain full authorship, dates, venues, identifiers, contribution, novelty, impact, evidence signal, link status, and repository statistics.
Evidence labels describe the kind of source behind an entry, not its scientific quality. Each label means the same thing on every row, so it is defined once here rather than repeated in the tables; a row carries an extra note only when its link was access-restricted or unavailable at the latest check.
| Evidence label | Rows | What it means |
|---|---|---|
| Research paper | 59 | Published or accepted research record |
| Research preprint | 320 | Preprint; inspect methods and evaluation |
| Official documentation | 73 | Primary product or standard behavior |
| Technical documentation | 10 | Technical reference from the source |
| Source implementation | 129 | Inspectable source and runtime behavior |
| Implementation | 11 | Working implementation or runtime |
| Benchmark or evaluation | 67 | Repeatable tasks, scores, or evaluation data |
| Project artifact | 50 | Schema, example, guide, or repository documentation |
| Reusable artifact | 2 | Adaptable template, schema, or guide |
| Operational pattern | 11 | Transferable operating practice |
| Practitioner analysis | 114 | Experience-backed implementation context |
| Risk analysis | 11 | Failure modes, limits, or adoption cautions |
| Discovery index | 17 | Broader ecosystem coverage for finding related work |
Start Here
Direct resources about the new AI/coding-agent meaning of Loop Engineering.
| Resource | Published at | Contribution | Evidence |
|---|---|---|---|
| π Loop Engineering by Addy OsmaniBlog | addyosmani.comAddy Osmani | Addy Osmani's framing of loop engineering as the layer above manually prompting coding agents, with concrete primitives across Codex and Claude Code; also on Substack with the original discussion trail and Steinberger and Cherny quotations. | Practitioner analysis |
| π Peter Steinberger on designing loopsBlog | 2026 Β· X (formerly Twitter) | The June 2026 post - "you shouldn't be prompting coding agents anymore, you should be designing loops that prompt your agents" - that catalyzed the current discussion. | Practitioner analysis |
| π Boris Cherny: five tips for running Opus autonomously for hours or daysBlog | 2026 Β· X (formerly Twitter) | The Claude Code creator's compact loop recipe: auto-mode permissions, dynamic workflows, /goal or /loop, the cloud runner, and end-to-end self-verification. |
Practitioner analysis |
| π Loop Engineering by Cobus GreylingBlog | SubstackCobus Greyling | Concise explanation of the shift from prompting agents to designing loops that discover work, delegate, verify, persist, and continue. | Practitioner analysis |
| π Stop Prompting. Design the Loop.Blog | 2026 Β· pulumiEngin Diri | Practical breakdown of loop building blocks - automations, worktrees, skills, connectors, subagents - plus external memory and verification through oracles such as tests and builds. | Practitioner analysis |
| π Writing Loops, Not Prompts, ExplainedBlog | rico.codes | Rico Kahler's break-even model for when a recurring task justifies building a loop instead of prompting, with stop conditions, evidence collection, and an execution-horizon framing for moving from execution-bound to judgment-bound work. | Practitioner analysis |
| π Loop Engineering: A Guide for Engineers and PractitionersBlog | 2026 Β· MediumAdnan Masood, PhD. | Adnan Masood's practitioner guide that organizes loop design into triggers, topologies, verifiers, and termination rules, with coverage of failure modes, cost control, and observability for production agent loops. | Practitioner analysis |
| π Loop Engineering: When Generation Gets Cheap, Judgment Gets ExpensiveBlog | SubstackStephane Derosiaux | Stephane Derosiaux's essay on the economics of the loop layer (generation becomes abundant while judgment becomes the bottleneck), proposing evaluator agents that must act rather than merely review, and cataloging failure modes such as unverified merges and quota depletion. | Practitioner analysis |
| π Andrew Ng on Loop Engineering and the Three Loops of AI-Native Product DevelopmentBlog | 2026 Β· X (formerly Twitter) | Andrew Ng's letter laying out three product-development loops (agentic coding in minutes, developer feedback in hours, external feedback in days) and arguing that human-in-the-loop persists wherever the human knows something the AI does not. | Practitioner analysis |
| π From Prompting Agents to Loop EngineeringBlog | 2026 Β· X (formerly Twitter) | DAIR.AI founder Elvis Saravia's X article examining the claim that you should stop prompting coding agents and start designing loops that prompt them for you. | Practitioner analysis |
| π My Lord! AI Programming Undergoes Another Major ShiftBlog | eu.36kr.com | Broad coverage of the Boris Cherny and Peter Steinberger discussion, including the distinction between cold-start scripts and persistent agent loops. | Practitioner analysis |
| π The Anthropic leader who built Claude Code ditched prompting - now he writes loopsBlog | 2026 Β· The New StackJanakiram MSV | The New Stack's report on Boris Cherny's shift from prompting to loop writing and what it changes about developer workflow. | Practitioner analysis |
| π Engineering for Agents That Never SleepBlog | SubstackNader Dabit | Cognition's Nader Dabit predicts the human-initiated share of Devin sessions will invert from 70/30 to 10/90 within a year as signals like alerts and failing tests trigger agents directly, recasting the engineer's job as designing triggers, constraints, and quality gates. | Practitioner analysis |
| π Loop Engineering Orange BookBlog | 2026 Β· GitHubalchaincyf/loop-engineering-orange-book | Plain-language bilingual (Chinese and English) field guide to loop engineering by HuaShu, framing the discipline as one floor above harness engineering: the outer system that decides when and why agents run. | Practitioner analysis |
| π How I AI: How to Write AI Agent Loops in Claude Code and CodexBlog | lennysnewsletter.comLenny Rachitsky | Mozilla distinguished engineer Brian Grinstead demonstrates goal-based and scheduled loops, including a daily PR-review loop with per-PR subagents, on Lenny's Newsletter. | Practitioner analysis |
| π Proof-or-Stop: Don't Trust the Agent, Trust the Evidence -- Loop Engineering for Verifiable Evidence-Gated Lifecycle ControlPaper | 2026 Β· arXivJek Huang et al. | Defines evidence-gated lifecycle control for agent loops and reports zero false-DONE outcomes across 10 scenarios and zero accepts across 18 tampering classes; its 9,240-cell ablation identifies which gates prevent error amplification, while noting the evaluation covers one model family and 24 tasks. | Research preprint |
What Counts As Loop Engineering
| Qualifies | Does not qualify |
|---|---|
| AI/coding-agent loops that coordinate prompts, context, harnesses, verification, and state over repeated agent runs | Software event loops, UI/game loops, or control theory loops |
| Scheduled, goal-driven, or event-triggered agent work | Generic cron jobs with no agentic reasoning or verification |
| Agent loops with durable state, worktrees, checkpoints, traces, or progress files | One-off prompt examples with no loop, state, or feedback signal |
| Verification loops using tests, CI, evals, reviewers, or deterministic gates | Pure AI news, generic product pages, or marketing copy |
| Multi-agent maker/checker/delegation patterns | Broad agent lists without specific loop-design relevance |
Model-level recurrence belongs in the map when it explains the model inside an agent: a learned block or latent state is iterated to allocate compute, refine reasoning, or simulate a world. It is an adjacent foundation, not a complete operational loop. The outer system still needs work intake, tools, external verification, durable state, budgets, escalation, and exit.
The Loop Contract
A Loop Contract is a reviewable operating specification for one recurring agent job. It is not a legal agreement, a long prompt, or a particular runtime. It records the decisions a person normally supplies during a one-off session - what work is authorized, what the agent may touch, what evidence counts, what survives, and when control returns to a human - so those decisions remain stable across runs.
The contract becomes necessary when an agent runs from a schedule, event, queue, or goal instead of waiting for live supervision. Unanswered questions become hidden defaults: the agent may select the wrong work, widen its own scope, approve its own output, forget a previous failure, or retry without a stopping rule. Making the policy explicit lets builders, reviewers, security teams, and operators inspect the same boundaries before the loop acts.
Prompt, context, and harness choices improve one run. A pattern describes how a class of recurring work should operate. The contract fixes the exact policy for one implementation, and the runtime executes it.
Read It As Three Decisions
| Phase | Contract parts | What the phase decides
Comments (0)
Sign in to join the discussion.
No comments yet
Be the first to share your take.