How Agent Harnesses Work: A Breakdown of Four Agent Frameworks
This article explains what an agent harness is and why it matters as much as the underlying model. Using fixed-version snapshots of four frameworks, it compares their design priorities, code size differences, and four typical technical routes: minimal, shared server, memory write-back, and multi-channel. It also outlines a four-dimension approach to choosing the right framework for your use case.
How Agent Harnesses Work: A Breakdown of Four Agent Frameworks
1. One Model, Four Completely Different Agents
Connect the same large language model to four different agent frameworks and you get four agents with sharply different behavior. One takes a minimal route, keeping only the core reasoning loop. One uses a shared server architecture that serves multiple client sessions at once. One writes newly learned skills back into long-term memory. And one focuses on channel coverage, connecting to more than thirty chat entry points.
This is only the tip of the difference. The model weights have not changed. What changed is the layer wrapped around the model. Understanding that layer is more valuable than memorizing any framework comparison table.
The approach here is to first build a conceptual model of the harness, then compare how different design priorities show up in code size, and finally offer a reusable selection method. The specific implementations discussed all come from fixed-version snapshots, because these projects iterate quickly and only a locked version makes source-level comparison meaningful.
2. What Exactly Is a Harness
A large model is essentially a machine that takes text in and puts text out: it reads tokens and emits tokens. It does not query databases on its own, execute commands, or remember the previous turn. To make it do more, you have to add capabilities around it, typically by giving a reasoning model memory, tool calling, and retrieval channels so it can interact with the world beyond tokens.
So an agent can be cleanly split into two halves:
- Model weights: responsible for reasoning and generation, with the capability ceiling set by the model itself;
- Agent harness: responsible for adding capabilities to the model and translating the tokens it emits into real actions.
The word harness originally refers to a horse’s tack. A horse needs a harness to pull a cart, and a model needs a harness to get work done. The “framework” and “harness” mentioned later in this article refer to the same kind of thing.
The model is stateless and does not change on its own; the harness is everything around the model: assembling prompts, parsing and executing tools, saving session state, setting safety guardrails, and managing the context window. Together, they make up what is usually called an agent.
Schematically, a minimal loop looks roughly like this:
# Core skeleton of a teaching-grade harnessmessages = [system_prompt(), user_input]while not finished:reply = model.generate(messages) # The model only produces tokensif reply.tool_calls:for call in reply.tool_calls:result = dispatch(call) # The harness does the actual executionmessages.append(tool_result(result))else:finished = True
In just over a dozen lines, this already covers three things: prompt management, tool dispatch, and message accumulation. Almost all the complexity of a production-grade framework comes from making these three things solid.
3. Why the Harness Matters as Much as Switching Models
A common misconception is that when results are poor, you should switch to a larger model. In practice, though, the harness often has no less impact on the final result than the model, and in some scenarios even more.
There are three reasons. First, context is designed. Given the same conversation history, how you trim it, summarize it, and inject retrieval results directly determines what the model sees. Second, tools are constrained. If a tool description is vague, the model will pick the wrong tool or pass the wrong arguments; if the returned result is too long, it will crowd out the context. Third, boundaries are backstopped. An agent without guardrails is nearly unusable in production, and a single accidental deletion can cause irreversible loss.
So a more accurate judgment is: the model sets the capability ceiling, and the harness determines how close you get to that ceiling.
4. Code Size: The Most Intuitive Difference in Design Priorities
Put the four kinds of frameworks side by side, and the most obvious difference is code volume. The teaching-oriented implementation on the far left is only a few hundred lines, because it needs to be printed in full in a book and readers must be able to read it in one sitting and reproduce it. Production-grade frameworks are one to two orders of magnitude larger, and the extra part almost all handles: safety guardrails, cross-session state persistence, more complex memory layering, multi-client concurrency, channel adaptation, and observability.
This scale chart is really a requirements checklist: every extra line of code you write answers the question of “what could go wrong” in some real scenario.
5. Four Typical Technical Routes
Minimal route. Keep only the reasoning loop plus a few tools, with state held in memory. The advantages are transparency, easy debugging, and low latency, making it suitable for teaching, evaluation, and as a starting point for your own harness; the cost is a narrow capability boundary and amnesia on restart.
Shared server route. Use one long-running server to hold sessions and a tool registry, with multiple clients (command line, desktop, web) connecting as thin clients. The benefits are centralized state, consistency across clients, and easy unified auditing; the difficulties lie in concurrency control, session isolation, and failure recovery.
Memory write-back route. Abstract successfully completed tasks into reusable skills, write them back to long-term storage, and call them directly the next time a similar task appears, forming a “stronger with use” loop. The key design lies in deciding when an interaction is worth persisting and how to avoid repeatedly reusing wrong experience.
Multi-channel access route. Use an adaptation layer to unify more than thirty chat entry points into the same internal message format, so the core logic is written only once. The difficulty is the differences among channels in message length, rich text, authentication, and callback mechanisms, which require an anti-corruption design to isolate.
6. How to Choose
It is recommended to score across four dimensions rather than looking at who has more stars:
- Whether state needs to survive across sessions: if so, prioritize a shared server and external storage;
- Number and risk level of tools: the more tools, the more you need strict permission tiers and human confirmation;
- Whether experience accumulation is needed: if so, focus on whether the memory write and recall mechanisms are auditable;
- Number of access channels: for multiple channels, prefer a solution with a clear adaptation layer.
There is also a piece of engineering experience: first get the loop working with a teaching-grade implementation, clarify which capabilities you actually need, and then gradually replace components with production-grade ones. Introducing a huge framework first, the other way around, often gets you slowed down by a large amount of abstraction you do not use.
7. Conclusion
The competition among agents is half in the model and half in the harness layer outside the model. Once you understand the composition of the harness, the sources of its scale, and the four mainstream routes, selection no longer relies on gut feeling. In practice on cloud platforms such as Baidu AI Cloud, these capabilities usually sit on general-purpose infrastructure such as container platforms, object storage, message queues, and log monitoring. Getting the architecture judgment right first and then discussing specific products is the reliable path.
