Agent Harness Architecture: Four Framework Patterns and How to Choose
An agent harness turns a language model into a working system by managing tools, context, state, safety, and execution. This article compares four harness design patterns—minimalist, shared-service, skill-memory, and multichannel—and outlines a six-module reference architecture, selection checklist, and engineering practices for production deployments.
1. Why the Same Model Can Produce Four Different Agents
Put the same large language model into four different agent frameworks, and you can get four agents with different capabilities, interaction patterns, and memory strategies.
One takes a minimalist approach, retaining only the basic input–reasoning–output loop. Another uses a shared service process to support multiple clients. A third turns successful workflows into reusable skills and writes them back to memory. A fourth focuses on connecting users through dozens of chat and messaging channels.
These are only some of the differences. The key takeaway for developers is this: the model sets the capability ceiling; the harness determines how much of that capability the system can realize. A poor fit often reflects a mismatch between the harness architecture and the application, rather than an inadequate model.
2. Breaking Down an Agent: Model Weights + Harness
At its core, a language model takes tokens as input and generates tokens as output. The inference core does not independently retain previous interactions or update its own weights. To interact with the real world, it needs surrounding software that assembles prompts, executes tools, saves sessions, enforces safety controls, and manages concurrency and permissions.
That surrounding layer is the agent harness. Just as a physical harness allows a horse to pull a load, an agent harness connects a model’s reasoning capabilities to useful work.
Agent = Model weights (inference core) + Harness (operational layer)
In this article, “harness” and “framework” refer to the same category of surrounding software.
This distinction has practical value: it turns the vague complaint “the agent does not work well” into two engineering problems that can be diagnosed and optimized separately.
3. Codebase Size: A Visible Signal of Complexity
Comparing harness codebases reveals differences of orders of magnitude. At the smallest end are educational implementations, designed to fit within a book and demonstrate what building a harness involves: a loop, a prompt template, and a tool registry.
Production frameworks can be one or two orders of magnitude larger. Much of the additional code addresses problems that simplified examples leave out:
- Persistent state and recovery across sessions.
- More sophisticated memory layers, including short-term context, long-term facts, and skill libraries.
- Safety controls such as input filtering, tool allowlists, confirmation for dangerous actions, and output review.
- Concurrency, client isolation, rate limits, and quotas.
- Observability, including tracing, token and cost accounting, and failure replay.
Codebase size is not a measure of quality. It is a signal of complexity and the scope of responsibility. Educational frameworks are small because they do not assume production responsibilities. Production frameworks are larger because they surround an unreliable model with a more reliable engineering system.
4. Four Common Harness Design Patterns
4.1 Minimalist: Keep Developers in Control
A minimalist harness retains only the essential execution loop. It provides no built-in memory, channel integrations, or safety controls.
Its strengths are low cognitive overhead, predictable control flow, and code that is easy to inspect and modify. The trade-off is that developers must add every production capability themselves.
This pattern suits education, prototyping, and teams that already have a mature engineering foundation and only need to replace or integrate the inference core.
4.2 Shared-Service: One Process, Multiple Clients
This pattern separates the harness into a shared server and multiple clients. The server owns session state, the tool registry, and tool execution; clients handle interaction.
The benefit is that state and tools do not need to be deployed separately on every client, and multiple clients can access the same context.
The challenges follow from that shared ownership: session isolation, concurrent write conflicts, permission boundaries, and state consistency during failures. Problems that were local to a single application can become distributed-systems problems.
4.3 Skill-Memory: Make Successful Experience Reusable
The defining mechanism is a feedback loop. After a task succeeds, the harness abstracts the reusable workflow into a “skill” and stores it in memory. When a similar task arrives, it retrieves relevant skills before reasoning.
Instead of starting from scratch each time, the agent reasons with prior experience. For repetitive tasks, this can substantially reduce token consumption and latency.
The main risk is memory contamination. Incorrect experience may become persistent, while an expanding skill library can reduce retrieval quality. Versioning, confidence tracking, and retirement mechanisms are therefore essential.
4.4 Multichannel: Expand the Interaction Surface
A multichannel harness prioritizes connectors, supporting dozens of chat and messaging entry points through a common adaptation layer for message formats, authentication, and callbacks.
It addresses the question of where users interact with the agent. The engineering emphasis shifts from reasoning quality toward adapter consistency, message deduplication, rate limiting, and channel-specific compliance.
5. A Reusable Six-Module Harness Architecture
Regardless of the chosen pattern, an evolvable production harness can be organized into six modules:
┌──────────────────────────────────────────────────────────────┐│ Connectors Channel adapters / Authentication / ││ Message normalization │├──────────────────────────────────────────────────────────────┤│ Orchestration Loop control / Concurrency / Interrupt-resume │├──────────────────────────────────────────────────────────────┤│ Context Prompt assembly / Memory retrieval / Skills │├──────────────────────────────────────────────────────────────┤│ Tools Registry / Argument validation / ││ Execution and rollback │├──────────────────────────────────────────────────────────────┤│ Guardrails Input-output review / Permissions / ││ Confirmation for dangerous actions │├──────────────────────────────────────────────────────────────┤│ Observability Tracing / Metering / Auditing / Replay │└──────────────────────────────────────────────────────────────┘↓ Stateless inference core ↓
The following pseudocode illustrates the structure of the main loop, rather than a complete implementation:
def run(task, session):while not done(task):ctx = context.build(system=PROMPT,memory=memory.recall(task, session), # Long-term facts + skillshistory=session.recent(limit=N), # Short-term context)action = model.invoke(ctx) # Stateless inferenceif guard.deny(action): # Check before executionsession.append(reason=guard.reason)continueresult = tools.execute(action, policy=POLICY) # Validate + executesession.append(action, result)if is_success(result):memory.write_skill(abstract(task, result)) # Store reusable experiencereturn session.summary()
6. A Harness Selection Checklist
Answer these questions in order to narrow down the appropriate architecture:
Do multiple clients need to share the same context?
If yes, consider a shared-service harness. If not, start with a minimalist approach.Are tasks highly repetitive, with workflows that can be abstracted?
If yes, skill memory offers the greatest potential benefit.Where do users primarily interact?
If they are spread across channels, prioritize connector coverage and consistency across the adaptation layer.Can the model execute actions with side effects?
If yes, guardrails and auditing are mandatory requirements, not features to add later.Can the team operate distributed state reliably?
If not, avoid introducing shared services and distributed memory too early.What is the cost model?
When costs are metered by token usage, memory and skill reuse are direct ways to reduce repeated inference work.
7. Engineering Recommendations
Start stateless, then add state. State is a major source of complexity. Where possible, move it outside the inference process and into general-purpose infrastructure such as object storage, message queues, logging services, and monitoring and alerting systems.
Enforce guardrails before execution. Tool allowlists, argument validation, and confirmation for dangerous operations must take effect before an action runs, rather than serving as after-the-fact patches.
Treat observability as a first-class requirement. Without tracing and replay, diagnosing harness failures becomes extremely difficult.
Make memory removable. Assign versions, confidence levels, and expiration policies to skills and facts to prevent long-term contamination.
Pin versions for baseline evaluations. Frameworks evolve quickly. Comparisons should use fixed version snapshots and the same task suite for regression testing.
8. Conclusion
A harness is not merely an accessory to a model. It is the layer that turns reasoning capability into an operational system.
Separate model weights from the harness when diagnosing performance. Use codebase size to understand complexity and responsibility, the six-module architecture to establish a common design vocabulary, and the selection checklist to evaluate trade-offs.
As model capabilities converge, the harness becomes a practical place to build differentiation—because its architecture, behavior, and operational controls remain in your hands.
