The 7 Loops of Harness Engineering
Designing Unstoppable AI Workflows
Part 2 of 2 — Second Draft Labs
Part 1 traced how AI execution evolved from chaotic mega-prompts to the harness: a software system built around the model that manages context, sequences tasks, and keeps the AI’s desk clean. But knowing a harness exists is different from knowing how to build one.
The core mechanism is simple. Instead of one sprawling conversation where the model accumulates baggage, a harness spins up a fresh model instance, feeds it a single micro-task, saves the output externally, flushes the context window, and loops. Task, save, flush, repeat.
But not all loops are the same. Different problems demand different architectures, and knowing which one to reach for is the design skill that separates workflows that hold up from ones that crack under pressure. Here are the seven essential patterns, in order of increasing complexity.
1. The Chunk-and-Append Loop
The Volume Handler
The simplest loop, and usually the first one people build. The harness splits the source material into chunks — by page, paragraph, token count, or logical section — feeds one chunk to the model with a consistent instruction, appends the output to an external file, and moves on with a fresh context window.
It solves the quality tapering that kills long-document outputs: when the whole document is in context, the model degrades halfway through; when only the current chunk is in context, every section gets the same focused attention. Reach for it when your problem is about volume — batch contract review, large research corpora, summarizing lengthy transcripts.
2. The Critic-Reviewer Loop
The Quality Gate
LLMs are pathologically agreeable. Ask a model to write something and it produces output confidently, even when the result is mediocre or off-brief. The Critic-Reviewer loop forces the model to argue with itself.
A Writer Agent produces a draft. A Critic Agent, in a completely separate context with no memory of the drafting, evaluates it against a rubric. If it fails, the Critic returns structured feedback, the Writer gets a clean context with only the brief and those notes, and the loop repeats until it passes. The separation is the whole point — you’re creating adversarial pressure from a clean perspective, not asking one instance to self-edit. Define the rubric tightly, with binary pass/fail criteria; a vague rubric produces vague feedback and the loop spins forever.
3. The Plan-Execute-Refine Loop
The Strategic Controller
Most multi-step tasks involve a plan that looks reasonable at the start and hits an unexpected wall in the middle. A wrong assumption at step 3 means every later step builds on a broken foundation — and a rigid system bulldozes straight through it.
A Planning Agent turns the goal into an explicit, numbered checklist. The harness executes each step in its own clean context, and after each one a Refinement Agent checks whether the output matched the assumption and rewrites the remaining steps if something needs to change. This is what lets a system adapt when reality diverges from the plan — without a human restarting from scratch. Use it for multi-phase research where early findings redirect later sections, or architecture planning where a constraint found at step 4 reshapes steps 5 through 10.
4. The ReAct / Tool Loop
The Action Handler
Everything so far keeps the AI working with text it already has. The ReAct loop is what you use when the model needs to go get information from the real world. It runs on a four-beat cycle:
Thought: the model reasons about what it needs next
Action: it triggers a tool call — a database query, API request, web search, file read
Observation: the result (or error) comes back
Next Thought: the model interprets what came back and decides what to do
The cycle repeats until the model has enough grounded data to answer. Because every claim is forced to rest on actual system feedback, the model can’t fabricate — the loop is a forcing function for accuracy. It’s the foundation of nearly every “agentic” product you’ve seen demoed: agents that query live databases, support systems that pull real account data, research tools that synthesize current results.
5. The Explore-and-Narrow Loop
The Research Grid
Some problems are too branching for a single linear path. When you need to investigate multiple hypotheses at once, a sequential loop is too slow and too narrow.
The harness spins up several independent Explorer Agents, each in complete isolation, each chasing a different hypothesis or data source. Their findings save externally, and once all threads finish, a separate Judge Agent receives a clean synthesized summary and produces the output. The isolation prevents context explosion — a single agent juggling five threads is a recipe for confusion — and the synthesis happens on summarized data, not a sprawling mess of accumulated reasoning. Use it for competitive analysis across markets, multi-source due diligence, or debugging where several root causes are plausible at once.
6. The Human-in-the-Loop Gate
The Safety Valve
Autonomy is powerful; unchecked autonomy in high-stakes workflows is a liability. This gate is a design feature, not a failure of automation — the architecture you use when the cost of a wrong AI decision exceeds the cost of a brief human pause.
The harness runs autonomously until it hits a predefined trigger: an ambiguity it can’t resolve, a cost above a set threshold, a confidence score below a minimum, or a high-stakes action like sending a customer message or committing code. When it fires, the loop pauses, saves its entire state, and surfaces a summary to a reviewer. The human approves, modifies, or redirects, and the harness resumes exactly where it stopped. The sophistication is in the trigger design: spend real engineering time deciding what should pause the loop and what can run free.
7. The Rollback and Recovery Loop
The Fault Tolerance Master
Every complex system fails eventually. In a 30-step workflow, step 17 producing a hallucination or hard error doesn’t just break step 17 — it breaks 18 through 30, because they’re all downstream.
At each significant step, the harness saves a clean checkpoint: the verified state of all outputs to that point. When a later step fails validation, the harness doesn’t crash or restart from scratch — it rolls back to the last checkpoint, adjusts a variable (temperature, prompt phrasing, the model itself), and tries an alternate path. Brittleness becomes resilience. Use it for long-running data pipelines, multi-stage content generation, or autonomous research where one API timeout shouldn’t trigger a full restart.
The Summary Matrix
The Final Mindset Shift
When you type a prompt into a chat interface, you are an operator — in conversation with a model, hoping it produces something useful, bound by its limitations. When you design a harness, you are an architect: the model is one powerful but constrained component, and your design choices determine what it can accomplish.
The loops above are a design vocabulary, not a list of tricks. Match the right loop to the right complexity layer and step 100 of a workflow runs with the same precision as step 1. The model never gets tired. It never loses context. It never drifts. Because you never let it.
Second Draft Labs publishes practical frameworks, thought pieces, and “Banana Ball” ideas for teams building seriously with AI. If this series changed how you think about AI infrastructure, share it with a builder on your team.




Are you using API calls to create these harnesses? "Spinning up new instances" is a bit opaque for me.