Agent Harness Design: Heavy Infrastructure or Lightweight Add-On?
This article clarifies the boundaries between agent frameworks, runtimes, and harnesses, then compares two design paths: a heavy infrastructure base versus a lightweight add-on layer. It provides a four-dimension decision framework covering reliability, concurrency and isolation, observability and compliance, and evolution frequency, along with a recommended architecture of a thin core with pluggable heavy capabilities. Common anti-patterns and a practical implementation checklist are included to help you choose the right approach based on your reliability budget.
1. Define the Boundaries First: Three Layers and What a Harness Actually Does
Before debating “heavy versus lightweight,” we need a shared vocabulary. The industry usually splits agent-related capabilities into three layers:
- Framework layer: Provides building blocks such as prompt templates, tool abstractions, and memory interfaces. It answers “how to write it.”
- Runtime layer: Provides durable execution, streaming output, human-in-the-loop interaction, and checkpoint recovery. It answers “how to run it.”
- Harness layer: An opinionated, packaged encapsulation with preset prompts, tool sets, integration patterns, memory strategies, and context management. It answers “how to run it reliably as a product.”
Another definition is closer to engineering reality: a harness is the runtime support layer around the agent main loop (think → act → observe), responsible for retries, state persistence, event routing, concurrency control, and observability. This definition pulls the harness back from “framework usage” to “infrastructure responsibility,” and it is the baseline for this article.
Key point: A harness boundary is not determined by lines of code, but by the reliability level it promises. The closer the promise is to “the business cannot be interrupted,” the more it behaves like infrastructure.
2. The Essential Difference Between the Two Design Paths
Heavy Infrastructure Path
State machines, queues, scheduling, isolation, and auditing are built as platform capabilities, turning the harness into an opinionated runtime base. The advantages are clear failure domains, horizontal scalability, and auditability. The costs are high upfront investment, slower iteration, and a tendency toward over-engineering.
Lightweight Add-On Path
The core loop stays minimal, with retries, logging, and rate limiting attached through hooks. The advantages are fast onboarding, replaceability, and low coupling with business code. The cost is a ceiling on capabilities imposed by the host environment; once cross-process recovery or strong concurrency is required, a rewrite is forced.
The dividing line usually appears in three metrics: whether task duration exceeds a single request lifecycle, whether concurrency requires cross-instance scheduling, and whether failures allow manual intervention and compensation.
3. A Decision Framework: Four Dimensions for Verifiable Choices
- Reliability level: How much progress can be lost? Do you need at-least-once or exactly-once semantics?
- Concurrency and isolation: Do you need multi-tenant isolation, resource quotas, or priority queues?
- Observability and compliance: Do you need full-chain tracing, audit trails, or data residency constraints?
- Evolution frequency: Prompt and tool changes happen far more often than infrastructure changes, so the two should be decoupled.
Illustrative decision logic (pseudocode):
if task_duration > single_request_limit or cross_instance_recovery_required:choose heavy base: persistent state machine + event-driven schedulingelif concurrency < single_machine_capacity and failures_are_retryable:choose lightweight add-on: hooks + local cacheelse:hybrid: lightweight loop + managed queue and logging services
4. Recommended Architecture: Lightweight Core + Pluggable Heavy Capabilities
The more robust engineering approach is not either/or, but “a very thin core with pluggable capabilities.” The core keeps only an explicit loop and a clear state contract:
while not done:state = load(state_id)decision = think(state)result = act(decision)state = observe(state, result)save(state_id, state)
On top of this, capabilities are mounted as needed: retries and backoff, idempotency keys, concurrency gates, timeouts and cancellation, event routing, tracing, and metrics. This preserves the replaceability freedom of the lightweight layer while allowing a switch to managed container platforms, message queues, object storage, logging services, and monitoring and alerting—general cloud capabilities—without binding to any proprietary interface.
5. Common Anti-Patterns and an Implementation Checklist
Anti-patterns include: writing prompt logic into infrastructure, which makes canary releases impossible; storing critical state in memory, which causes amnesia on restart; tool calls without idempotency design, which cause duplicate side effects; and logs that contain only text without structured fields, which cannot be replayed.
Implementation checklist: define a state contract and version number for each execution; introduce idempotency keys for all side-effect tools; separate retry policies from business compensation policies; establish replay and load-testing capabilities; apply layered context trimming (system constraints, long-term memory, current task, tool results) and set budget limits.
