The scaffolding around an agent loop, and what each layer of it buys
Twelve steps, four parts, three runnable tasks — six switchable layers, measured three ways.
- All 12 steps, read online
- Runnable labs to download (plain Python, runs offline)
- Free updates whenever it's revised
- 14-day refund (conditions)
Introduction
Your agent works in a demo and cannot be trusted in production. You have improved the prompt several times and the failures have moved rather than gone: it guesses a file path, repeats a call that taught it nothing, or announces success while wrong.
Why the prompt is not where the fix is
A working agent is a model inside a program, and almost none of that program is the model. A better prompt cannot invent a tool that does not exist, cannot name a failing case the error text withheld, and cannot stop a model that has already declared victory.
| who wrote it | can you change it today | |
|---|---|---|
| the model | a vendor | no |
| the prompt | you | yes, and you already have |
| the harness | you | yes — this volume |
The third row is the subject. It is entirely yours, it is code, and unlike the model you can change it this afternoon.
What an agent harness is
An agent harness is everything around the model call: the tools it may use, the text it gets back, the checks on what it claims, the window it works in, and the record of what it did.
Six switchable layers, and this volume measures what each one buys by holding the model fixed and turning them off one at a time.
| layer | off | on | step |
|---|---|---|---|
| tool_surface | a shell and one overloaded file operation | narrow, typed verbs | 3 |
| rich_errors | FAIL 3/6 | the failing cases, and what to do about them | 4 |
| verifier | the model's word is accepted | the harness checks, and refuses a false finish | 5 |
| context_budget | drop the oldest events until it fits | compact, keeping the facts that stay true | 6 |
| recovery | repeat until the budget runs out | notice the repeat, nudge once, then stop | 7 |
| observability | counters only | the full trace, replayable | 7 |
The honest headline, up front
Is this for you?
| if… | then |
|---|---|
| your agent announces success and is wrong | step 5 — and the answer is not a better prompt |
| it guesses at file paths or argument shapes | step 3, which is the largest effect measured here |
| it repeats a call that told it nothing | step 7 |
| it works, and you cannot say why | step 7's second half — every finding in this volume came from a trace |
| it works and you trust it | you may not need this volume. Step 11 says which layers to skip |
How the measurement works
One scripted, deterministic model, so a change in the outcome can only have come from the harness. Three tasks. Six layers. And three measurement modes, because the first two both under-report:
| mode | what it does | what it hides |
|---|---|---|
| the ladder | switch layers on one at a time | an easy task does not exercise most of them, so they look worthless |
| leave-one-out | remove each layer from a complete harness | same blind spot, from the other direction |
| stress | run each layer under a condition that exercises it | nothing — this is the one that reports honestly |
The third mode exists because of a result in step 8: a measurement that does not stress a layer will report that the layer is worthless, and that is a fact about the measurement.
How to read the source labels
| label | means |
|---|---|
| concept | argued from first principles, quotes nothing from a lab |
| measured | a lab compares two configurations and reports the difference |
| hands-on | you run it on your own material |