The harness, not the prompt, makes an agent reliable
A harness is the code around the model: tools, context, guardrails, the loop, and a verify step. In this talk, an old model learns to upvote a story on Hacker News, and the prompt never changes.
- The model reads messages and picks the next step. You rent it, and you cannot see inside it.
- The tool registry lists what the agent can do. In the demo these are browser tools, such as go to a page, click, and read text.
- The agent loop sends the history to the model, runs the tool it picks, adds the result, and asks again.
- Context management trims or compacts the history, so a long run does not overflow the context window.
- Guardrails are hard limits on the loop. The demo stops at 15 iterations or 50 messages.
- Verify is plain code that runs after the loop. It checks what happened, not what the model says happened.
Why a harness
You rent the model, so reliability must come from your code
Think of a climbing harness. It ties you to the mountain, which does not move, so you do not fall. A dog harness keeps the dog from running off and, in his words, from bankrupting you with tokens. An agent harness ties a model that changes to code that does not.
Two meanings
“Harness” means two things, and this talk is about the agent kind
Eval harness
It measures a model. Nothing runs in production.
Agent harness
It controls an agent while it runs. This is the kind in Fig. 1.
The demo
Same prompt, same old model, and only the harness changed
He builds a browser agent live. He picks an older model on purpose, and he does not change the prompt at any point. Each run adds parts to the harness.
gpt-3.5-turbo-0613, an older model with less skill than current ones.Bare agent
It hits the login page, gives up, and reports success.
+ guardrails
The run can no longer loop forever. The login page still stops it.
+ verify
The harness reports the failure instead of the agent’s claim.
+ login handler
The harness logs in with code. The vote lands, and verify agrees.
The last run
The harness logs in, so the model never has to
- The agent clicks upvote. Hacker News wants a signed-in user, so the browser lands on the login page.
- The harness checks the URL after each step. It sees the login page, fills in the form, and submits it. The model is not called.
- The harness adds a system note to the history that says the agent is now logged in.
- The agent continues with the same prompt, and this time the upvote lands.
- Verify reads the trace. It finds the click on the vote link and no login page left unresolved, so it reports passed: true.
Verify
Verify reads the trace, not the agent’s last message
The bare agent said it upvoted the story. It did not. A model’s report on its own work is not evidence. The trace is. It holds every tool call and every page the browser visited.
Takeaway
Fix behavior in the harness, not in the prompt
A login page, a loop that does not end, a history that grows too long, and a claim with no proof each have a part of the harness that fixes them in code. Code does the same thing every run. A longer prompt does not.
The demo used an old model on purpose. With a good harness, a smaller and cheaper model can do the job. He gave IBM’s open-source OpenRAG as an example of the same idea at company scale: a security harness around retrieval over private data such as PDFs, invoices, and call transcripts.
What to remember
Ground the model in code you control
- A harness is everything around the model: tool registry, context management, guardrails, the agent loop, and verify.
- Treat the model as a black box you rent. Do not rest reliability on the prompt alone.
- Put hard limits on every run, for example 15 iterations and 50 messages.
- Verify in code. Check the trace or the real state, never the agent’s own report.
- When the agent fails at a step that is the same every time, such as a login, handle that step in the harness and leave the prompt alone.
Practice
Which part of the harness fixes it?
Pick a part for each failure. “Prompt” is on the list too.
Guardrails
A cap on iterations or messages ends the run. A prompt that says “do not loop” is a request, not a limit.
Verify
Check the trace or the real state after the run. The agent’s last message is not proof.
Context management
Keep the system prompt and the task, and trim or compact the old tool output in between.
Agent loop
This works like the login handler. The loop sees the banner, closes it with code, and tells the agent. No model call.
Tool registry
Add a tool that reads files. The model cannot do what no tool lets it do.
Related lesson
Evals check the agent before deploy. The harness guards it at run time.
Sources
© 2026 Hardeep Singh