Agent Harness Design: Balancing a Lean Core with a Robust Runtime
This article examines the architectural trade-off between lightweight agent harnesses and full production runtimes. It explains how to separate concerns across three layers—build abstractions, execution runtime, and the harness itself—why task strategy should stay lean while reliability infrastructure remains essential, and how to design pluggable modules and stable interfaces. It also covers context management, risk-based architecture choices, and evaluation criteria covering quality, cost, recoverability, safety, and diagnosability, concluding that strategies can be thin as long as boundaries stay firm.
The Real Question Is Not “Heavy or Light,” but Where Complexity Lives
Discussions about agent system architecture often present two seemingly opposite positions.
One camp argues that agents must be built on complete infrastructure: task scheduling, state storage, permission management, audit trails, fault recovery, and monitoring should all be brought into the system in a unified way. The other camp argues that models are already capable enough that only prompts, a few tools, and an execution loop are needed, and that complex frameworks merely add development burden.
Both positions capture real aspects of the problem.
For short-lived, low-risk, single-user tasks, a simple loop can indeed reduce development costs effectively. But for long-running tasks, cross-system operations, multi-user collaboration, or tasks involving funds and sensitive data, no amount of model capability can substitute for deterministic engineering controls.
So the more useful questions are not “how many lines of code should there be,” but:
- Which capabilities must live inside the agent’s minimal core?
- Which capabilities can be composed as modules on demand?
- Which reliability requirements should be handled by an independent runtime?
- Which interfaces need to stay stable to reduce the cost of swapping models and tools?
A more reasonable conclusion: the task-strategy core of a harness should trend lean, but the infrastructure that supports production operation does not disappear. Complexity is more likely to be re-layered than eliminated.
First, Separate Three Layers—Don’t Call Everything a Harness
There is no single industry-standard definition of a harness yet. Some discussions treat it as the task wrapper around a model, while others extend it to the execution infrastructure. To avoid conceptual confusion, responsibilities can be divided into three layers.
1. Build Abstraction Layer: Improving Development Efficiency
This layer provides the foundational capabilities for organizing prompts, describing tools, structuring messages, adapting model calls, and accessing memory.
It answers “how to build agents more conveniently,” not “how to keep tasks running after a failure.”
Appropriate abstraction reduces duplicated code, but excessive abstraction tends to cause two problems: developers struggle to understand the real execution path, and new model capabilities may be constrained by old interfaces.
This layer should therefore prioritize clear data structures and composability rather than forcing all tasks into one complex workflow.
2. Execution Runtime Layer: Ensuring Tasks Run Reliably
The runtime manages the execution lifecycle, including task state, checkpoints, timeouts, cancellation, retries, concurrency coordination, and resuming after human approval.
These capabilities should be implemented primarily by deterministic code. The model can propose the next action, but it must not decide on its own to bypass an approval, nor can task state persistence be guaranteed by a prompt.
The value of the execution runtime is that even if a process exits, a tool fails, or human approval is delayed, the system can still determine where a task stopped, which actions have already occurred, and which steps can safely resume.
3. Harness Layer: Organizing the Model to Complete a Task
In this article, harness refers to the control layer that connects the model, context, tools, and task strategy.
It is responsible for:
- Organizing the information visible to the model;
- Selecting or restricting the tools available in the current turn;
- Running the “think–act–observe” interaction loop;
- Judging whether the task has met its completion condition;
- Applying appropriate strategies when information is insufficient, budget is exhausted, or risk rises.
The three layers can be deployed in the same process or split into separate services. What matters is not the physical location but clear responsibility boundaries.
A lean harness does not mean no runtime; a complete runtime does not mean the harness must become a bloated business framework.
Why the Task-Strategy Core Can Get Thinner
As models improve in instruction following, tool calling, and task planning, some capabilities previously compensated for by engineering code can gradually be handed back to the model.
For example, systems used to need explicitly prescribed steps: classify first, then decompose, then select tools, and finally generate a summary. For tasks with clear boundaries, the model may now complete these steps with less intervention.
At that point, keeping complex multi-layer planners, repetitive reflection loops, and fixed role-based collaboration may not improve outcomes. Instead, it can increase call counts, context bloat, and failure points.
But this trend comes with two caveats.
First, model capability gains do not benefit all tasks equally. Long-chained operations, scarce-domain knowledge, and strictly constrained tasks may still require explicit workflows.
Second, any reduction in orchestration must be validated through evaluation. You cannot conclude that a simpler approach is more reliable in all production scenarios just because it demos more easily.
The safer strategy is: start with the simplest control flow that is sufficient to complete the task, and only add new strategy modules when real failure samples prove a gap.
Why Production Infrastructure Doesn’t Disappear as Models Get Stronger
Models solve semantic understanding and decision-making problems; production systems must still handle failures, resource contention, and external side effects.
1. External Operations Have Non-Ignorable Side Effects
A failed document read can simply be retried. A failed order creation, approval submission, or configuration change cannot simply be repeated.
Especially after a call times out, the system may not know whether the external operation actually succeeded. Retrying directly can then cause duplicate writes.
Appropriate countermeasures include operation identifiers, idempotency controls, result queries, and manual verification. Whether recovery can be automated depends on the capabilities the external system offers, not on whether the model is “smart enough.”
2. Long-Running Tasks Need Persistent State
Long-running tasks may experience service restarts, network interruptions, human waits, or resource migrations. Keeping message history only in memory cannot satisfy these scenarios.
The system needs to persist task state, tool call records, key artifact references, and approval results. Checkpoints should be built around explicit state transitions, rather than casually saving a copy of the conversation text and assuming recovery capability.
3. Multi-User Operation Requires Resource Governance
When multiple agents simultaneously access shared tools, they can trigger rate limits, contend for resources, or process the same object repeatedly.
The runtime needs concurrency caps, task priorities, timeout budgets, and cancellation mechanisms. When shared data is modified, locks, version checks, or other coordination mechanisms may also be needed.
These capabilities belong to systems engineering; they cannot be substituted by prompts.
A Sustainable Architecture: Lean Core, Replaceable Modules, Stable Interfaces
An evolvable harness can be organized around the following flow:
Task input
→ Identity and permission checks
→ Context assembly
→ Model decision
→ Tool call validation
→ Execution and result recording
→ State update
→ Completion judgment or next iteration
1. A Lean Core Maintains Only the Necessary Invariants
At minimum, the core must be clear about:
- The task’s current state;
- Which capabilities the model may use this turn;
- Whether tool calls satisfy the constraints;
- How call results are fed back to the model;
- Under what conditions to continue, pause, fail, or end.
The core does not need to embed every retrieval algorithm, business approval workflow, or storage implementation, but it must ensure these modules can be integrated within controlled boundaries.
“Thin” here means concentrated responsibilities and few dependencies—not deleting necessary validation.
2. Pluggable Modules Absorb Fast-Changing Capabilities
Context retrieval, history compression, task planning, risk identification, result verification, and artifact management can all be designed as replaceable modules.
However, modularity does not mean turning every function into a plugin. Overly fine-grained extension points increase configuration cost and behavioral uncertainty.
Capabilities suitable for modularization typically share three characteristics: noticeably divergent requirements across use cases, frequent changes in implementation, and clearly describable inputs and outputs. In contrast, permission boundaries and critical state transitions should stay centrally managed, preventing plugins from bypassing core constraints on their own.
3. Stable Interfaces Reduce Migration Cost
Stable interfaces do not necessarily mean a unified industry protocol covering all agent scenarios. A more pragmatic approach is to first define consistent interaction contracts internally.
For example, tool calls should clearly specify input constraints, output structure, error types, and side-effect attributes; task events should carry correlation identifiers; state recovery should state which data is authoritative.
Cancellation, timeout, and retry semantics must also be defined. Otherwise, even if interfaces look uniform on the surface, different modules may have completely different understandings of “failure.”
Context Management Determines Whether a “Lean Core” Actually Works
A harness’s effectiveness depends not only on the execution flow but also on what information the model sees at each step.
Simply appending the entire history makes it easy for key constraints to be drowned in large volumes of tool output. Compressing too early risks losing task details and evidence chains.
A more sensible context organization distinguishes information types:
- Current goals and inviolable constraints;
- Confirmed facts and key decisions;
- Unresolved questions;
- Recent rounds of interaction;
- Historical records and external materials available on demand.
Large volumes of raw tool output can be stored in a separate artifact store, with summaries and references retained in context. Summaries must preserve sources and uncertainty; speculation must not be compressed into fact.
Moreover, content from documents, web pages, or tool output should be treated as external data, not automatically promoted to system instructions. Tool permissions and execution validation must remain independent, preventing malicious content from influencing high-risk operations through the context.
How to Decide How Heavy the Architecture Should Be
Architecture choices should be driven by task risk and operating conditions, not by whatever concept is currently fashionable.
Scenario 1: Low-Risk, Short-Duration, Read-Only Tasks
For tasks like research compilation and assisted analysis, start with a single-process loop, basic logging, and explicit step limits.
The priority is validating the task’s value; there’s no need to introduce complex scheduling prematurely. But error handling, input boundaries, and result checks should still be retained.
Scenario 2: Internal Business Assistants
When an agent needs to access internal materials, use an employee’s identity, or call business APIs, you should add identity verification, permission filtering, audit logging, and moderate task persistence.
The main contradiction here is usually not that the model can’t plan, but that data boundaries, call permissions, and failure recovery are unclear.
Scenario 3: Long-Duration or High-Risk Automation
For important configuration changes, business submissions, and multi-stage approvals, you need complete state management, human confirmation, idempotency, and fault-recovery design.
A workable approach is to have deterministic processes constrain the key nodes while letting the model handle understanding, analysis, and candidate generation within each node—rather than letting the model freely decide the entire business flow.
Evaluation Must Cover Quality, Cost, and Recoverability
Judging a harness only by whether a task eventually succeeds is insufficient. At minimum, evaluate:
- Task quality: whether user goals are met and results are verifiable;
- Execution cost: model call count, tool call count, total latency, and resource consumption;
- Reliability: behavior after tool timeouts, process interruptions, and dependency failures;
- Security: privilege escalation, sensitive data leakage, or approval bypass;
- Diagnosability: after a failure, whether you can locate the issue in the context, decision, or tool execution stage.
Evaluation sets should include realistic failure types such as missing information, conflicting tool outputs, duplicate events, and cancellation requests. For tasks with side effects, verify whether repeated execution causes inconsistencies.
Both architectural simplification and architectural hardening should depend on these results: if removing a planning module leaves quality unchanged while cost drops, simplification is justified; if fault-recovery tests repeatedly fail, strengthen the runtime rather than continuing to optimize prompts.
Conclusion: Strategy Can Be Lean, Boundaries Must Be Firm
The future of harnesses is more likely a layered convergence: task strategy stays lean, capabilities are composed from modules, production reliability is carried by an explicit runtime, and modules collaborate through stable contracts.
This is neither a wholesale rejection of heavy infrastructure nor an unconditional endorsement of lightweight add-ons. What truly needs avoiding are two extremes: stacking complex abstractions for needs that don’t exist yet, or omitting necessary safety and reliability mechanisms for the sake of surface simplicity.
For development teams, the most effective evolution path is: first define task boundaries and risks, then build an evaluable minimal closed loop, and then add capabilities based on failure evidence. Let the model handle the parts suited to semantic reasoning, while deterministic systems maintain permissions, state, and side-effect boundaries.
Ultimately, a good harness is not about how heavy it looks, but whether it uses the minimal necessary complexity to let an agent reliably complete tasks—and, when it cannot, stop safely, clearly, and recoverably.
