How to Build an Agent Harness with Claude Fable 5
An agent harness is the runtime scaffolding around a model like Claude Fable 5: a loop that drives turns, a tool dispatcher, a context manager, and a verification gate that checks the work before finishing. Build it by making each part explicit and swappable, then wire in retrieval as the harness's memory so the agent searches chunks before generating.
What an agent harness actually is
The word "harness" gets thrown around as if it means the model. It does not. Claude Fable 5 is the reasoning engine. The harness is the runtime you build around it: the code that sends turns, runs tools, decides what the model sees, and checks whether the work is real. A powerful model with a sloppy harness produces confident, unverified nonsense. An ordinary model with a disciplined harness finishes tasks.
This guide covers a single-agent harness: one model, one loop, doing one task at a time. Coordinating several agents is a different problem with its own failure modes, covered separately. Here the goal is a harness reliable enough that you would let it run unattended on a real task.
Four components carry the load. The loop driver advances the conversation turn by turn. The tool layer gives the model typed actions and turns their output into feedback. The context manager decides what the model can see on each turn, and this is where retrieval lives. The verification gate decides whether the task is actually finished. Miss any one and the harness fails in a predictable way: no verification and it declares broken work done; no context discipline and it drowns in its own history; no loop guard and it thrashes forever.
Component 1: the loop driver
The loop driver is the spine. It runs one cycle: send the conversation and available tools to Fable 5, read the response, and branch. If the response is a tool call, dispatch it, append the result, and send again. If it is a final answer, hand off to verification. This is the whole engine, and its correctness comes down to how it stops.
Stop conditions, not just success
A loop driver needs three exits, not one. First, a success signal: the model reports the task complete and verification agrees. Second, a hard iteration cap: after N turns the driver halts regardless, so a failing command cannot be retried forever. Third, a stall detector: if the last few turns repeat the same tool call with the same arguments, break and escalate rather than burn tokens. Fable 5 is capable, but no model reasons its way out of a loop your driver never lets it exit. The stop logic is yours to own.
Component 2: the tool layer
A tool is a typed function the model can request. It has a name, a JSON input schema, and a description written as an instruction rather than a label. The model never executes anything itself; it emits a structured call and your dispatcher runs the real function. Two design rules decide how well this works.
First, keep tools narrow. A read_file(path), a run_tests(), and a retrieve(query) beat one do_action(kind, payload), because each tight schema teaches the model what is possible. Second, treat every tool result, including errors, as feedback the model must see. A failed test, a stack trace, a non-zero exit code: format it cleanly and append it. The harness improves not by hiding failures from Fable 5 but by returning them in a form the model can act on. In practice you register these tools through an MCP server, which exposes your functions over a standard protocol without the loop driver needing to know their internals.
Component 3: context management is the harness's memory
The failure mode of long-running agents is context, not intelligence. Every turn appends more history. Left alone, the window fills, cost climbs, and the agent loses the thread. The context manager is the harness component that fights this, and it is best understood as the agent's memory: it decides what to remember, what to summarize, and what to fetch on demand.
The principle is that the model should see exactly what this decision needs and nothing else. A 300-line file that mattered eight turns ago is dead weight now; replace it with a one-line summary. This is where retrieval reshapes the harness. Instead of carrying everything in context and hoping, the agent calls a retrieval tool that pulls the exact chunk it needs, when it needs it.
Retrieval as the memory layer, with RDK
Back the context manager with RDK, the Retrieval Development Kit. You index your vault, docs, or codebase as encrypted private chunks on the RDK network. The harness then makes retrieve(query) the agent's first move on any factual step, before generation. This is stacked retrieval: private vault chunks resolve 40 to 65 percent of queries directly, the public RDK network adds another 15 to 20 percent from chunks other builders have published, and Fable 5 handles only the remaining 5 to 10 percent as fallback. The model still does the reasoning and synthesis; it just stops regenerating facts it can look up. That is the mechanism behind an 80 to 90 percent drop in token spend, and it keeps the context window small enough that the loop stays coherent over long runs.
Component 4: the verification gate
This is the component that turns a demo into a harness, and the one most people skip. When Fable 5 says the task is done, that is a claim, not a fact. The verification gate tests the claim before the loop is allowed to exit.
Verification means exercising the work, not asking the model to grade itself. For code, that is running the test suite, the typechecker, and where possible the actual flow the change touches. For a data task, it is re-querying and checking the output shape. If the gate fails, it does not stop the run; it feeds the failure back into the loop as a new tool result, and the agent gets another turn to fix it. This self-correction cycle, propose then verify then repair, is what lets a harness run unattended. Without it, the harness is a text generator that stops when the model feels finished.
Why "ultimate" is the wrong goal
No harness is ultimate, and chasing that word leads to over-engineering. A harness is fit for a task class, and you measure it on three things. Task completion rate: what fraction of real tasks finish correctly without a human stepping in. Token efficiency: how much of the work was retrieved or verified cheaply versus regenerated. Recoverability: when a step goes wrong, does the harness catch it and repair, or does it ship the mistake.
Build the four components explicitly and keep them swappable, because you will replace parts as the task changes: a stricter verification gate for production code, a leaner context manager for long research runs. Start with the loop and tools, add the verification gate before you trust it unattended, and back the context manager with retrieval so the agent stops paying to regenerate what it already knows. That is a harness worth running, and it is a better target than a superlative.
Frequently asked questions
- What is the difference between an agent, an agent harness, and the model?
- The model, such as Claude Fable 5, is the reasoning engine. The agent is the running behavior: a model plus tools pursuing a goal. The harness is the runtime that makes that behavior reliable: the loop driver, tool dispatcher, context manager, and verification gate. You swap models inside the same harness; the harness is the part you own and tune.
- Do I need to build a custom harness for Claude Fable 5, or can I use an existing one?
- Most teams start with an existing harness like Claude Code, which already ships the loop, tool dispatch, and iteration guards. You build custom pieces when your task needs them: a domain-specific verification gate, custom tools via an MCP server, or a retrieval-backed context manager. Understand the four components either way, so you know why an agent stalls, thrashes, or ships bad work.
- How does retrieval fit into an agent harness?
- Retrieval is the context manager's memory layer. Instead of carrying full history in the prompt, the harness gives the agent a retrieve tool that pulls the exact chunk it needs each iteration. With RDK, private vault chunks answer 40 to 65 percent of queries and the public network adds 15 to 20 percent, cutting token spend 80 to 90 percent while keeping context small.
- How does the harness know when the agent is actually done?
- Through the verification gate, not the model's say-so. When Fable 5 reports completion, the gate exercises the work: it runs tests, the typechecker, or the real flow the change touches. If verification fails, the failure is fed back as a tool result and the agent gets another turn to repair it. The loop exits only when verification and the success signal agree.
- Is a single-agent harness enough, or do I need multiple agents?
- For most tasks a well-built single-agent harness is enough, and it is where you should start. Multiple agents add coordination overhead and new failure modes that only pay off when a task splits cleanly into parallel sub-tasks. Get the loop, tools, context, and verification solid on one agent first; orchestration is a separate layer built on top of harnesses that already work.