Agent Harness Tutorial · Architecture
The horse and the harness
A horse is strong and fast, and it will pull all day. But it doesn't know the road, it can be startled, and now and then it bolts. Nobody fixes that by shouting at the horse. We put it in a harness: blinkers, reins, a cart and a driver. A language model is the horse. Our code is the harness. The harness's one goal is to keep the horse on the green path.
Three colours of road.
- Green is the job done properly: Rohan asks something, the tools answer it, and the reply says only what the tools returned.
- Yellow is allowed, but only with care. A write Rohan didn't clearly ask for means we ask him first. A payout over ₹25,000 means we wait for a person. A stale status means we read it again.
- Red is never allowed, however the model was talked into it: promising cover, paying without approval, showing someone else's data, obeying orders hidden in a document.
Each part of the harness has a job on the road.
| Horse and cart | In our harness | Its job on the road |
|---|---|---|
| The horse | the model | Pulls the work forward. Strong, fast, doesn't know the road. |
| Blinkers | the tools it may see | It can't run towards what it can't see: issue_payout is never shown. |
| The bit and bridle | the context and system prompt | Tells it which way to face before it moves. |
| Reins | the checks at 8 points | Pull it back from yellow; stop it before red. |
| The driver | the router and rules | Picks the route. Walks the easy bits without the horse at all (the direct path). |
| The cart | state and memory | Carries what was said and what was done, so nothing falls off between trips. |
| Stopping for the toll gate | DBOS approvals | Waits for a person to wave it through, however long that takes. |
| The journey log | the trace and eval | Records every step, so we know if it drifted, even when it got there. |
The lesson of the whole tutorial fits in one line: assume the horse will sometimes bolt, and build the harness so it can't leave the road. A better horse (a better model) helps, but it never replaces the reins.
Why not just train a better horse?A smarter model drifts less often, but nobody can promise it never drifts, and in insurance one bolt into red costs real money. Reins are cheap, exact and testable; they work the same with any horse. That is why every check that protects money is in our code, not in the model.