Agents Research Digest Infrastructure

Agent Harness Engineering: The Seven-Layer Infrastructure Behind Reliable AI Agents

18 min read  ·  2026-06-28  ·  MindTechLabs  ·  Survey: TMLR 2026 · 170+ systems analysed

The model is not the reliability bottleneck. Peer-reviewed research across TMLR, NeurIPS, ICLR, and COLM now converges on a single finding: task execution reliability depends less on the underlying model than on the infrastructure layer that wraps it — the agent execution harness. This article maps that research to the ETCLOVG seven-layer taxonomy and shows what it means for how you build.

What Is a Harness (and Why It Is Not a Framework)?

The term "harness" originates in software testing — the scaffolding that drives a component under test, feeds it inputs, and captures outputs. Applied to LLM agents, the harness is the runtime wrapper that manages everything the model itself cannot: environment isolation, tool access, memory state, error recovery, and policy enforcement.

This is categorically different from a framework. LangChain and LangGraph are frameworks — they provide abstractions and patterns for composing agents. The harness is the execution host that actually runs those compositions: it controls what the model can touch, what happens when it fails, and whether its actions are safe to execute.

Key finding (TMLR 2026 survey): A survey of 170+ open-source agent systems found that framework-level improvements plateau quickly; reliability gains consistently come from harness-layer engineering — better sandboxing, richer context policies, tighter verification loops, and explicit governance constraints.

The ETCLOVG Seven-Layer Taxonomy

The most comprehensive peer-reviewed framework for harness architecture is the ETCLOVG taxonomy, introduced in "Agent Harness Engineering: A Survey" (under review, TMLR 2026). It names seven layers that every production harness must address:

E
Execution Environment
T
Tool Interface
C
Context Management
L
Lifecycle / Orchestration
O
Observability
V
Verification
G
Governance

The taxonomy has a deliberate internal structure: E, T, C, and L form the structural core — they describe what a harness physically does. O, V, and G form the control plane — they describe how the harness maintains correctness, visibility, and safety over time. A harness missing any layer is incomplete; one missing any control-plane layer is unsafe for production.

Layer E — Execution Environment

The execution environment manages runtime isolation, resource allocation, and sandboxing. This is the physical boundary between the agent's actions and the host system.

Research on full-stack harnesses (OpenHands at ICLR 2025; AIOS at COLM 2025; SWE-agent at NeurIPS 2024) consistently shows that sandboxed execution is non-negotiable for any agent that generates or executes code. The standard implementation hierarchy runs from Docker containers (most common, strong isolation), through gVisor (kernel interception, lower overhead), to Firecracker microVMs (strongest isolation, used in serverless). WebAssembly is emerging as a lightweight alternative for pure-compute sandboxes.

Why it matters: "SandboxEscapeBench" (Marchand et al., arXiv 2026) quantified frontier LLM capability to escape container sandboxes — finding that some models can opportunistically exploit exposed Docker APIs or overly permissive mounts. If your agent executes code or shell commands, your execution environment is a security boundary, not a convenience.

The execution environment also governs step limits, recursion depth bounds, and resource ceilings. These are not merely performance concerns — they are the primary mechanism for preventing runaway agent loops. The ETCLOVG survey found that over 60% of open-source harnesses implement no step ceiling at all, which is a reliability gap rather than a feature.

Practical pattern for Azure AI Agents

# Azure AI Agent Service — constrained execution pattern
from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import AgentRunStatus

project = AIProjectClient.from_connection_string(os.environ["PROJECT_CONNECTION"])
agent = project.agents.get_agent(os.environ["AGENT_ID"])

thread = project.agents.create_thread()
project.agents.create_message(thread.id, role="user", content=query)

# Enforce step ceiling at the harness layer — not left to the model
run = project.agents.create_and_process_run(
    thread_id=thread.id,
    agent_id=agent.id,
    max_prompt_tokens=20000,      # Context ceiling
    max_completion_tokens=4000,   # Output ceiling
    truncation_strategy={"type": "last_messages", "last_messages": 5}
)

if run.status == AgentRunStatus.FAILED:
    # Harness handles failure, not the model
    raise RuntimeError(f"Agent run failed: {run.last_error}")

Layer T — Tool Interface

The tool interface layer controls how an agent registers, discovers, and invokes external tools and APIs. This goes well beyond "function calling" — it encompasses tool schema validation, versioning, permission scoping, and what happens when a tool call fails.

"ToolLLM: Facilitating Language Models to Master 16,000+ Real-World APIs" (Qin et al., ICLR 2024) identified that naive tool provision — dumping all available tools into the context — degrades performance significantly beyond ~10 tools due to selection confusion. Production harnesses implement tool registries with semantic search: the agent retrieves only the tools relevant to the current subtask.

"Executable Code Actions Elicit Better LLM Agents" (Wang et al., ICML 2024) demonstrated that allowing agents to write and execute arbitrary code as a tool action — rather than constraining them to pre-defined function signatures — yields a 20–30% task success improvement across benchmarks. The Model Context Protocol (MCP, Anthropic 2024) has emerged as the industry standard for tool schema serialization.

The key principle: The tool interface should enforce a least-privilege model — an agent gets access only to the tools it needs for its declared task, not the full registry. This is the tool layer's contribution to governance.

Indirect prompt injection via tool responses is the primary attack vector at this layer. "InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated LLM Agents" (Zhan et al., 2024) showed that malicious content in tool return values can hijack agent action sequences. Harness-level sanitization of tool outputs — before they enter the context — is the mitigation, not model-level instruction.

Layer C — Context Management

Context management handles conversation history, working memory, long-term memory stores, and the policies that govern what gets included in the context window at each reasoning step.

"Lost in the Middle: How Language Models Use Long Contexts" (Liu et al., TACL 2024) established empirically that performance degrades for content placed in the middle of long contexts — models attend more reliably to the beginning and end. This finding directly informs harness context policy: recency-biased context pruning is not just a token efficiency measure, it is a reliability measure.

"Cognitive Architectures for Language Agents" (Sumers et al., TMLR 2024) formalizes the distinction between in-context storage (the current window), external storage (vector or key-value databases), and procedural memory (the model's weights). The harness is responsible for managing the interface between all three — deciding what to retrieve, when to evict, and how to summarise.

Three memory tiers the harness must manage

  • Working memory — the active context window; managed via sliding window, recency pruning, or compression
  • Episodic memory — stored conversation history and past trajectories; retrieved semantically (MemGPT / Mem0 pattern)
  • Semantic memory — domain knowledge in vector stores; retrieved via embedding search before each reasoning step

"A-MEM: Agentic Memory for LLM Agents" (Xu et al., NeurIPS 2025) introduced dynamic memory graph structures that outperform static retrieval — the harness actively reorganises memory based on observed task patterns rather than passively storing and retrieving.

Layer L — Lifecycle and Orchestration

The lifecycle layer handles task scheduling, retry logic, checkpointing, sub-agent delegation, and graceful termination. In multi-agent systems, it also governs the orchestration of parallel and sequential sub-tasks.

"Hell or High Water: Evaluating Agentic Recovery from External Failures" (Wang et al., COLM 2025) is the definitive paper on this layer. It characterised recovery strategies across 200+ failure scenarios, finding that checkpointing at action boundaries (saving agent state after each confirmed tool call, not after each LLM turn) yields 40% better task completion rates on long-horizon tasks compared to full restarts. Most open-source harnesses checkpoint too infrequently or not at all.

For multi-agent orchestration, "MetaGPT: Meta Programming for Multi-Agent Collaborative Framework" (Hong et al., ICLR 2024) and "CAMEL: Communicative Agents for Mind Exploration" (Li et al., NeurIPS 2023) both demonstrate that structured role assignment and explicit message passing protocols outperform free-form agent communication — the harness must enforce these protocols, not leave them to agent discretion.

Lifecycle anti-pattern to avoid: Unbounded retry loops. A harness that retries failed tool calls indefinitely — without backoff, circuit breakers, or escalation — is a reliability liability. The ETCLOVG survey found this in 43% of surveyed open-source systems. Max-retries with exponential backoff, followed by graceful degradation, is the correct pattern.

Layer O — Observability

Observability is promoted to an independent layer in ETCLOVG rather than treated as a side effect of logging. It encompasses structured tracing of reasoning steps, tool call latency, token consumption, and evaluation metrics — with its own dedicated tooling ecosystem.

The paper "Evaluation and Benchmarking of LLM Agents: A Survey" (Mohammadi et al., KDD 2025) defines three observability tiers for production agents:

  1. Trajectory logging — every thought, tool call, and observation recorded with timestamps and token counts
  2. Quality metrics — task success rate, step efficiency, hallucination rate, and tool error rate tracked per agent version
  3. Operational metrics — end-to-end latency, cost per task, retry rate, and timeout frequency for SLO monitoring

Enterprise deployments face a stark reality: the "AI Agent Observability and Evaluation" study (IJNRD 2025) found that 57% of organisations run agents in production, yet observability remains the lowest-rated part of the AI stack — with only 7–8% of firms reporting mature agent governance. This is the gap that harness-layer observability engineering closes.

The observability principle: You cannot debug what you cannot trace. Every agent action that touches an external system — a tool call, a memory write, a sub-agent delegation — must produce a structured trace event that can be replayed and audited. This is not a nice-to-have; it is the foundation on which verification and governance are built.

Tracing with the Claude API

# Claude API — structured harness tracing pattern
import anthropic, time, json, uuid

client = anthropic.Anthropic()

def traced_agent_turn(messages: list, tools: list, run_id: str) -> dict:
    turn_id = str(uuid.uuid4())
    start = time.perf_counter()

    response = client.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=4096,
        messages=messages,
        tools=tools
    )

    duration_ms = int((time.perf_counter() - start) * 1000)

    # Structured trace event — emitted to your observability platform
    trace = {
        "run_id": run_id,
        "turn_id": turn_id,
        "stop_reason": response.stop_reason,
        "input_tokens": response.usage.input_tokens,
        "output_tokens": response.usage.output_tokens,
        "duration_ms": duration_ms,
        "tool_calls": [
            {"name": b.name, "input": b.input}
            for b in response.content if b.type == "tool_use"
        ]
    }
    # emit_trace(trace)  # send to Langfuse / Arize Phoenix / OpenLLMetry
    return {"response": response, "trace": trace}

Layer V — Verification

The verification layer implements validation loops, error detection, and self-correction before outputs are returned to users or passed to downstream agents. This is the harness's quality gate — distinct from the model's own self-assessment, which is unreliable without external scaffolding.

"Adapting the Interface, Not the Model: Runtime Harness Adaptation for Deterministic LLM Agents" (Xu, Wen & Li, arXiv May 2026) is the seminal paper on this layer. Their Life-Harness system demonstrated that converting recurring interaction failures into reusable environment contracts, procedural skills, action realization rules, and trajectory regulation policies — all managed at the harness layer — achieved 88.5% average relative improvement across 116 of 126 model-environment configurations. Crucially, harnesses trained on one model transferred successfully to 17 others, proving these are harness-layer invariants, not model-specific fixes.

"PALADIN: Self-Correcting Language Model Agents to Cure Tool-Failure Cases" (Vuddanti et al., ICLR 2026) formalises four verification strategies that every production harness should implement:

  • Syntax validation — tool call schemas validated before execution, not after
  • Semantic validation — outputs checked against expected type and range constraints
  • Critic-model verification — a separate lightweight model evaluates whether the action is correct before committing
  • Trajectory rollback — on verification failure, roll back to the last valid checkpoint and retry with corrective context

"ReVeal: Self-Evolving Code Agents via Reliable Self-Verification" (arXiv June 2026) extends this with agents that synthesise their own verification oracles during task execution — the harness provides the scaffold for generating, storing, and reusing these oracles across runs.

The verification gap: "From Failed Trajectories to Reliable LLM Agents: Diagnosing and Repairing Harness Flaws" (arXiv June 2026) analysed 1,200 failed agent trajectories and found that 71% of failures were attributable to harness-layer flaws — missing validation, incorrect tool result handling, and context corruption — rather than model reasoning errors. The model is rarely the problem.

Layer G — Governance

Governance is the newest first-class layer in the ETCLOVG taxonomy, capturing the full spectrum of safety, compliance, and operational policy enforcement. It is elevated above observability and verification because it constrains what the agent is allowed to do — before any action is taken.

"Runtime Governance for AI Agents: Policies on Paths" (Kaptein, Khan & Podstavnychy, arXiv March 2026) provides the formal foundation: governance policies are functions that map agent identity, partial execution path, proposed action, and organisational context to a policy-violation probability. This formalism captures something critical — governance is path-dependent. An action that is safe in one context is unsafe in another. Static access controls and prompt-level instructions are special cases of this broader runtime evaluation requirement.

"SAGA: Security Architecture for Governing AI Agentic Systems" (Syros et al., NDSS 2026) translates this into a concrete implementation architecture: a sidecar governance process that intercepts every action proposal, evaluates it against active policies, and either approves, modifies, or blocks it — without going through the model's context window.

From a compliance standpoint, the EU AI Act's prohibited practice provisions became enforceable in February 2025, with general-purpose AI obligations following in August 2025. Any agent system operating in regulated environments needs the G layer to emit policy-adherent audit trails and enforce human-in-the-loop requirements on high-risk action categories.

Four governance mechanisms every production harness needs

  • Action allowlists/denylists — explicit lists of permitted and prohibited tool invocations per agent role
  • Data boundary enforcement — the harness, not the model, enforces which data sources the agent may read or write
  • Human-in-the-loop triggers — configurable thresholds that pause execution and escalate to a human on high-stakes actions
  • Immutable audit logs — append-only trace records that capture every governance decision, its policy basis, and its outcome

Structural Core vs Control Plane

The ETCLOVG taxonomy's most important architectural insight is the distinction between the structural core (E, T, C, L) and the control plane (O, V, G).

The structural core answers: "what does the harness do?" — manage execution, expose tools, maintain context, orchestrate lifecycle. The control plane answers: "how does the harness stay correct over time?" — by making behaviour visible (O), by catching errors before they propagate (V), and by enforcing the boundaries within which the agent operates (G).

"Externalization in LLM Agents: A Unified Review of Memory, Skills, Protocols and Harness Engineering" (Zhou et al., arXiv April 2026) frames this as cognitive externalisation: the harness converts tasks that require the model to maintain internal state — memory, error recovery, policy compliance — into external structures the harness manages deterministically. This is why harness engineering improves reliability without changing the model: it offloads non-deterministic cognitive burden onto deterministic infrastructure.

The architectural principle: Build the structural core first — your agent cannot run without it. Add the control plane before your first production deployment — you cannot operate safely without it. This sequencing is consistent across every well-engineered open-source system the ETCLOVG survey analysed.

What This Means for How You Build

"From Question Answering to Task Completion: A Survey on Agent System and Harness Design" (Guo et al., arXiv June 2026) synthesises the field's convergence: agent performance does not emerge from the model alone — it emerges from the interaction between model capabilities, runtime infrastructure, task structure, and evaluation methodology. Harness engineering is the lever you control most directly.

Concretely, this means your build checklist should mirror ETCLOVG:

  • E: Deploy into a sandboxed execution environment with explicit step limits and resource ceilings from day one
  • T: Build a tool registry with semantic discovery; enforce least-privilege tool scoping per task type
  • C: Implement a context policy (recency bias, episodic retrieval, sliding window) rather than appending all history
  • L: Add checkpoint-on-action-boundary and configurable max-retries with backoff before any long-horizon deployment
  • O: Emit structured trace events for every reasoning turn and tool call — into Langfuse, Arize Phoenix, or OpenLLMetry
  • V: Validate tool call schemas before execution and add a lightweight critic step before writing outputs to downstream systems
  • G: Define action allowlists, human-escalation thresholds, and data boundary rules as code — not as system prompt text
The production readiness threshold: Shipping an agent with only the structural core (E, T, C, L) is a prototype. Shipping with all seven layers is a production system. The control plane (O, V, G) is not optional — it is what makes the difference between a demo and a deployment.

Primary Research — Peer-Reviewed & Under Review

Agent Harness Engineering: A Survey

Anonymous Authors — Under review, Transactions on Machine Learning Research (TMLR), May 2026

openreview.net/forum?id=3hXEPbG0dh →

Externalization in LLM Agents: A Unified Review of Memory, Skills, Protocols and Harness Engineering

Zhou, Chai, Chen et al. — arXiv:2604.08224, April 2026

arxiv.org/abs/2604.08224 →

Adapting the Interface, Not the Model: Runtime Harness Adaptation for Deterministic LLM Agents

Xu, Wen & Li — arXiv:2605.22166, May 2026

arxiv.org/abs/2605.22166 →

Runtime Governance for AI Agents: Policies on Paths

Kaptein, Khan & Podstavnychy — arXiv:2603.16586, March 2026

arxiv.org/abs/2603.16586 →

From Question Answering to Task Completion: A Survey on Agent System and Harness Design

Guo, Hao, Wang et al. — arXiv:2606.20683, June 2026

arxiv.org/abs/2606.20683 →

OpenHands: An Open Platform for AI Software Developers as Generalist Agents

Wang et al. — ICLR 2025

AIOS: LLM Agent Operating System

Mei et al. — COLM 2025

SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering

Yang et al. — NeurIPS 2024

Cognitive Architectures for Language Agents

Sumers, Yao, Narasimhan & Griffiths — Transactions on Machine Learning Research (TMLR), 2024

ToolLLM: Facilitating Language Models to Master 16,000+ Real-World APIs

Qin et al. — ICLR 2024

Executable Code Actions Elicit Better LLM Agents

Wang et al. — ICML 2024

Hell or High Water: Evaluating Agentic Recovery from External Failures

Wang et al. — COLM 2025

PALADIN: Self-Correcting Language Model Agents to Cure Tool-Failure Cases

Vuddanti et al. — ICLR 2026

SAGA: Security Architecture for Governing AI Agentic Systems

Syros et al. — NDSS 2026

Lost in the Middle: How Language Models Use Long Contexts

Liu et al. — Transactions of the Association of Computational Linguistics (TACL), 2024

A-MEM: Agentic Memory for LLM Agents

Xu et al. — NeurIPS 2025

MetaGPT: Meta Programming for Multi-Agent Collaborative Framework

Hong et al. — ICLR 2024

← Back to Research Digest AI-103 Exam Prep →