Harness engineering: don't take the agent's word for it
Jake
An AI agent will tell you the tests pass. Sometimes they do. Sometimes it never ran them.
That's not the agent lying. It's guessing, and it sounds just as sure either way. So the most useful thing I've built around agents isn't a better prompt. It's a harness: the code around the agent that decides what work it gets, checks what it hands back, and decides what actually ships.
What a harness is
A harness is everything that isn't the model. It hands out tasks, gives agents tools, collects results, and enforces rules.
Mine does three things that matter most:
- It splits big jobs into small ones and runs them in parallel.
- It sends every result through a second agent whose job is to find problems.
- It only lets a change merge when there's evidence it works.
Fan the work out
One agent working through a big task in one long session tends to drift. It loses track of early decisions as its context fills with material it no longer needs.
So the harness breaks the work into small, separate pieces and gives each one to its own subagent. Each subagent gets a narrow job and only the context it needs. They run at the same time, so the whole job usually finishes faster too.
The trick is writing those handoffs well. A subagent knows only what you tell it. If the task description is vague, the result will be too.
Check the work with a skeptic
Every result goes through adversarial verification. A separate agent gets the change and one job: prove it's wrong.
That reviewer doesn't see the first agent's reasoning, just the code and the goal. That matters. If you hand a reviewer the author's explanation, it's more likely to go along with it. Give it only the work, and it looks with fresh eyes.
It's the same reason a good team doesn't let you approve your own pull request.
Gate merges on evidence
This is the rule I care about most: an agent saying "done" counts for nothing.
A change can only merge when the harness has proof:
- The tests ran, and the harness saw the output itself.
- The build passed.
- The reviewer found no blocking problems, or they were fixed and checked again.
If the evidence isn't there, the change doesn't move. Small changes don't get a pass.
Make failure cheap
Agents fail. Networks drop. A subagent goes off in the wrong direction. A good harness expects this.
What to do:
- Save progress after each step so a failed run can pick up where it stopped.
- Keep each task small enough that throwing it away costs little.
- Log what each agent did, so you can see where things went wrong.
When failure is cheap, you can let agents try more things. When it's expensive, you end up babysitting them.
Why this matters
Most of the talk about AI coding is about the model. In my experience, the model is rarely the problem. The problem is trusting output nobody checked.
A harness turns "the agent says it works" into "we can show it works." That's the difference between a demo and something you'd let near production.
In a future post: giving agents access to real systems without handing them the keys.
If you're building agent workflows for a team and want a second set of eyes, get in touch.