Harness, Part 4: Tools & Loop
Now it becomes an agent: tools that fit its purpose and the loop that keeps working until the task is done.
What this is about
Up to here you have built a very good chat. What makes it an agent is stage 4 of the staged model: tools - and the loop that uses them. The principle fits in three words: observe, decide, act. The model sees the conversation plus the tool list, decides whether to reach for a tool, your harness executes it and puts the result back into the conversation - and that repeats until an answer arrives without a tool call.
Two things matter more than any code here. First: a tool is a capability with responsibility - your agent gets not what would be cool, but what its north star needs. Second: a tool's description is the only thing the model "sees" of it. A precise description is the difference between an agent that reaches for the right tool and one that has to guess.
At the end of this part, this works: your agent completes a real small task on its own - and you watch it do so.
How the build works
As before: copy the prompt, hand it to your coding agent, answer its questions. The prompt first reads harness-doku.html - this time including your north star, because tools are about to be made from it.
This section belongs to the Member tier. You get access to full code, deeper explanations, and rabbit-hole material.
See tiers →It works when
Your agent has completed a real small task: reached for a tool, delivered a result, and you could read along with every step in the terminal. And go ahead, count: all four stages of Block I fit in a good 200 lines of code, without a single dependency. That makes it an agent - but one with full authority and no limits. Before it is allowed into daily use, it gets some: Part 5: Guardrails.