Building the harness · August 23, 2026 · 8 min
Output schemas are completion contracts
Most agent frameworks treat a schema as validation applied after the fact. Treat it instead as the definition of done — the run ends the moment a valid result is written — and three unrelated problems disappear at once: unbounded loops, unresumable runs, and work nobody can grade.
By Islam Hachimi, Founder
Ask a bookkeeper when they have finished the month and you get a clear answer: when the books balance and every question they could not answer is written down and sent to you.
Nobody says "when I ran out of things to do."
But that is what most AI systems do. The work ends when the AI stops taking actions, or when it hits a limit on how many steps it is allowed. Both of those describe the AI. Neither describes the job.
Checklist, not report card
Most systems check the work afterwards, like marking homework. We do the opposite. We write down what "done" means first, and the job ends the moment that list is satisfied.
Sounds like a small change. It fixes three separate problems.
1. You know whether it actually finished
When AI stops on its own, you cannot tell why. Maybe it did the job. Maybe it got confused. Maybe it wrote a nice summary of what it was about to do and called that done. All three look the same from outside.
With a definition of done, there is no guessing. Either the required pieces are there or they are not.
2. "I can't do this yet" becomes a real answer
This is the important one, and it is backwards from what you would expect.
If "done" only describes success, then a system that cannot do the job has two choices: fail, or make something up. AI leans hard toward making something up, because producing believable-looking answers is exactly what it is built to do.
Let "we can't do this yet, and here is what we need" be a valid answer, and the AI stops having to fake it.
One detail we had to learn the hard way. When something was not measured, the number has to be missing, not zero. Zero means we looked and found none. Missing means we did not look. A customer cannot tell those apart unless you are careful — and that difference is the whole trustworthiness of the number.
3. You can check the work before anyone sees it
A wall of text can only be judged by reading it. Work with a known shape can be checked automatically, before it goes anywhere near a customer.
Here is the one we care about most. When our system works out why an invoice has not been paid, one of the possible answers is "the client is unhappy about something."
When that is the answer, we send the client nothing. It goes straight to the business owner.
The reason is not technical at all. If someone has a complaint they have not told you about yet, sending them a payment reminder turns a fixable disagreement into a real fight. No automated message should ever be the thing that does that.
You cannot enforce a rule like that on a paragraph of text. You can enforce it on an answer.
If you want it, require it
The most useful thing we learned: if you want the AI to do something, make it part of what "done" means. Do not just ask nicely in the instructions.
We wanted our reports to end with "here is what to do next" instead of just numbers. Asking for it worked sometimes. Requiring it worked every time.
Same with the plain-English summary the customer actually reads. It is not a nice extra at the end. It is one of the things that has to exist before the job counts as finished.
What it does not fix
A definition of done tells you the work is complete. It does not tell you it is correct. You can get a perfectly complete, perfectly formatted, completely wrong answer.
What it does buy you is that everything after this point — the owner's review, the customer's portal, the invoice — is dealing with something real instead of hoping. That is not the same as being right. But nothing else works until you have it.