AI Agent Frameworks Explained: How the Harness Shapes Agent Behavior
This article breaks down four common AI agent framework architectures and explains why the same large language model can behave very differently depending on the harness around it. You will learn what an agent harness includes, how the minimal, shared-service, memory-driven, and multi-channel approaches differ in design and trade-offs, why production code is orders of magnitude larger than teaching examples, and how to choose an architecture based on state, memory, and security requirements.
1. Why the Same Model Produces Four Different Agents
Connect the same large language model to four different agent frameworks, and you end up with four agents that behave noticeably differently. One keeps only the minimum viable capabilities and prioritizes transparency and control. One uses a single always-on service to serve multiple clients. One turns successful execution into reusable skills and writes them back to memory. The last one covers more than thirty conversation entry points.
This points to an easily overlooked fact: an agent’s capability boundary is not determined by the model alone. The model only reads tokens in and emits tokens out. What actually decides what it can do, what it cannot do, and how it falls back when something goes wrong is the engineering layer wrapped around the model. The industry usually calls this layer the harness. A horse needs a harness to pull a cart, and a model needs a harness to do real work. In this article, “framework” and “harness” refer to the same kind of thing.
Note that this article does not evaluate any specific product. Instead, it abstracts four typical architectures and discusses their design logic and applicable boundaries. These frameworks iterate quickly, so any conclusion only makes sense when tied to a version. When reading the source code, be sure to pin a snapshot version.
2. What an Agent Harness Actually Contains
An agent can be split into two parts:
- Model weights: fixed parameter count, stateless inference, no trace of the previous session retained;
- Agent harness: all the engineering facilities around the model, responsible for assembling prompts, parsing and executing tool calls, maintaining session state, setting safety guardrails, and managing memory and retrieval.
# Minimal harness loop (illustrative)def run(user_input, session):session.messages.append({"role": "user", "content": user_input})while True:resp = model.generate(session.messages, tools=tool_schema)session.messages.append(resp.message)if not resp.tool_calls:return resp.message # done, return natural languagefor call in resp.tool_calls:result = tool_registry[call.name](**call.args) # tokens become actionssession.messages.append({"role": "tool", "content": result})
This loop reveals the harness’s essential job: translate the structured tokens produced by the model into real operations on the external world, then feed the results back into the context. Tool execution, state persistence, and permission checks all happen at this layer.
3. Abstract Comparison of Four Architectural Orientations
| Architectural orientation | Core design | Main benefit | Main cost |
|---|---|---|---|
| Minimal | Only “prompt + tool loop” | Extremely readable, suitable for teaching and secondary development | No cross-session state, weak guardrails |
| Shared service | Single always-on service, multiple client connections | Centralized state, zero burden on clients | The server becomes a bottleneck and single point |
| Memory-driven | Solidify successful experience into skills and write back to memory | Gets stronger with use, decreasing cost for repeated tasks | Risk of memory pollution and retrieval noise |
| Multi-channel | Adapt to a large number of external conversation entry points | Broad reach, low integration cost | Bloating adaptation layer, scattered security boundaries |
The difference among the four is not “which one is better,” but where complexity is placed. The minimal approach hands complexity to the user, the shared-service approach converges complexity on the server, the memory-driven approach shifts complexity to memory governance, and the multi-channel approach spreads complexity across the adaptation layer.
4. The Engineering Truth Behind Code Size
Put the code volume of the four frameworks side by side, and the gap is on the order of magnitude. The smallest teaching implementation is only a few hundred lines, because it has to fit into a book and be explained clearly. Production-grade implementations are often one to two orders of magnitude larger, and almost none of the extra code is “inference logic.” It is mostly:
- Safety guardrails: tool whitelists, parameter validation, second confirmation for dangerous operations, prompt injection protection;
- Cross-session state: session storage, resume from breakpoints, concurrency isolation;
- Memory systems: write policies, deduplication, expiration and eviction, hybrid vector and keyword retrieval;
- Observability: call chain tracing, token and latency statistics, failure retries and alerts.
The conclusion is straightforward: when reading source code, do not focus only on the few dozen lines of model calls. The real engineering substance is in the surrounding parts. When evaluating a framework, first confirm how well it handles these “surrounding” aspects.
5. A Selection Checklist by Scenario
- Teaching or prototype validation: choose a minimal implementation, get the loop running first, and understand what every line does;
- Consistent multi-device experience: choose the shared-service approach, but design horizontal scaling, session affinity, and rate limiting in advance;
- Long-term repetitive tasks: choose the memory-driven approach, and at the same time establish memory quality evaluation and a manual rollback mechanism;
- External services and multi-channel reach: choose the multi-channel approach, and consolidate authentication, content moderation, and log auditing at the adaptation layer.
If an enterprise already has cloud infrastructure, it can place state and memory on general-purpose capabilities, for example using object storage to save session snapshots, message queues to decouple tasks, container platforms to host always-on services, and logging and monitoring services for observability, so that state is not bound to a single process.
6. Conclusion
The same model, four harnesses, four outcomes—this is the most memorable lesson in agent engineering. The key to selection is not comparing the length of feature lists, but deciding which kind of complexity you are willing to take on: readability, centralization, memory governance, or reach breadth. First clarify the business requirements for state, memory, and security boundaries, then choose the framework. That order is usually more reliable than the reverse.
