AssayAssay
01 / 06

Lesson 01 · The stack · 12 min

The loop stack

The agent loop — a model calling tools until it is finished — is the part everyone builds first and the part everyone talks about. It is also the part that is nearly solved. What separates a demo from a system is the loops wrapped around it.

1 · Agent loopA model calls tools until the task is done. Covered in the agent-loops course, and the subject of most agent frameworks.
2 · Verification loopA separate checker grades the output against a standard, and a failure feeds back for another attempt.
3 · Event-driven loopThe agent stops being something you invoke and becomes something that runs — on a schedule, a webhook, a queue.
4 · Hill-climbing loopProduction traces are read, and the harness itself is changed. The outer loop reaches inside and edits the inner one.
The four-loop stack4 · hill-climbing3 · event-driven2 · verification1 · agent loopmodel calls tools until doneeverything else exists to make that trustworthy
Each loop wraps the one inside it. The innermost is the part most frameworks give you; the outer three are what makes it a system rather than a demo.

The stacking is the point. Loop two makes the output trustworthy enough to run unattended; loop three makes it run unattended; loop four makes it get better while it does. Each one is only useful once the one beneath it works.

The lab beside this lesson is loop two with a switch. Turn verification off and you have loop one alone: a single draft, shipped. Note that it always reports a pass — not because it was good, but because nothing looked at it. That is the honest state of most agents in production.

This is also a map of what you have already built. The evals course is where the standard in loop two comes from. The graph course, which comes later, is how you constrain what loop one may do. Neither was named as harness engineering when it was written, but that is what they are — and the harness engineering course, next, is where that idea gets its own treatment.

Checkpoint

Run the same task with verification off and on, and describe what the checker changed.

maker
checker

“My order 88213 arrived with a cracked base. I'd like a refund please.”

The natural, friendly reply promises the refund — which the agent cannot authorise.

Run once with the verification loop off and read the reply. Then run again with it on. The interesting comparison is not pass or fail — it is what changed between the drafts.

Run once with the verification loop off, then again with it on, and compare the replies.