Skip to content

The four layers of an agent system are loop, graph, harness, and meta-harness. When an agent burns tokens, declares the task complete, and then fails the tests, that is usually an architecture problem, not a prompting problem. The loop verifies work against external evidence. The graph decides where execution goes next. The harness is the model's operating environment — tools, permissions, memory, context, logging. The meta-harness governs many harnesses so context and policy can move between agents. Mercury Core is built as the harness and the meta-harness. This loop is not Mercury Loop, the managed service.

Agent architecture, verification loops, workflow graphs, agent harnesses, meta-harness governance, human-agent operating systems, prompt engineering limits, Mercury Core, Booster Packs, OpenClaw memory

Mercury Technology Solutions, Mercury Core, Mercury Flux, Mercury Loop, OpenClaw, Booster Pack, Unified Bus, Agent-native infrastructure

[ SYS: MERCURY_CORE // FIELD_NOTES ]

Field notes on agentic systems

The Four Layers of an
Agent System

An agent burns tokens, declares the task complete, and then fails the tests. That is usually an architecture problem, not a prompting problem. Here is the stack — and how to find which layer failed.

Four runtime layers. Build from the loop up.

In short

What the four layers of an agent system are

  • AI agents usually fail from architecture, not prompting: a better prompt cannot create a missing tool, gate, route, or policy.
  • The four runtime layers are loop (verify work), graph (route work), harness (expose capability), and meta-harness (govern many harnesses).
  • A reliable loop stops on external evidence — a passing test, a green build, a validated output — never on the model's self-assessment.
  • Mercury Core is the operating system built as the harness and the meta-harness: one memory, one interface, one policy layer.
  • The loop on this page is a runtime pattern. Mercury Loop is a different product: a managed service that keeps the OS from drifting.
The stack

Four layers at a glance

The four layers of an agent system — job, failure, and the fix before you rewrite the prompt.
LayerJobFailureFix first
LoopVerify work until evidence says stopAgent “completes” without a test, build, or validation gateAdd a measurable stop condition
GraphDecide where execution goes nextWrong route, no fallback, improvised handoffsMake branches, retries, and specialists explicit
HarnessExpose tools, memory, permissions, context, loggingThe model understands the task but cannot touch what it needsExpose the missing capability — a Booster Pack on Mercury Core
Meta-harnessGovern many harnesses; move context under one policyClaude Code, Codex, and internal agents as uncoordinated silosShared policy, isolation, and portable context — the Core substrate
Layer 01 — Loop

What is an agent loop?

An agent loop is the smallest unit of agency: act, check the result, then stop or try again.

A reliable agent never stops because the model believes the work looks correct. It stops on external evidence — a passing test, a green build, a validated output.

Act → check → (fix) → done

Watch the agent attempt the task twice. The first pass feels done — the check disagrees. Only the second pass passes the gate.

Act
Check
Retry
Done

Loop idle. Run it to watch a failed check, then a passing gate.

The rule

Stop condition

Stop on measurable conditions: tests pass, build succeeds, output validates — never on the model's self-assessment.

Failure mode

Without verification, an agent confidently declares success while the task is still incomplete.

Layer 02 — Graph

What is an agent graph?

An agent graph decides where execution goes next: branches, retries, specialist handoffs, fallback paths, and shared state.

A loop decides whether execution continues. A graph decides where it goes. Once a workflow has multiple routes, the graph makes them explicit, inspectable, and controllable.

New task
Standard route
Specialist agent
Retry / fallback
Degrade
Delivered
Route by task class
Handoff
After N failures

Graph idle. Route a task to watch a standard path fail over to a specialist.

Layer 03 — Harness

What is an agent harness?

An agent harness is the model's operating environment — tools, APIs, files, memory, permissions, context, and logging.

The model provides reasoning; the harness determines what that reasoning can actually do. Model capability and agent capability are not the same thing.

Tools
What the agent can touch and invoke
Permissions
What it is allowed to do
Memory
What it remembers between runs
Context
What it can see right now
Logging
What you can audit afterwards
Missing tool
No prompt fixes this. The agent stalls here.
The harness test

The model may understand exactly how to solve a task. But if the required tool, data source, or permission is not exposed through the harness, the agent still cannot complete it.

Five capabilities make the model operational. One gap makes the whole run fail — no matter how good the prompt is.

Layer 04 — Meta-harness

What is a meta-harness?

A meta-harness is the common layer above multiple agent harnesses: orchestration, governance, isolation, shared policy, and portable context.

Real teams run Claude Code, Codex, internal agents, and domain specialists side by side — each with its own tools, sessions, policies, and execution environment. Without a meta-harness, humans become the copy-paste layer between walled gardens.

Meta-harness · shared policy / governance / context portability
Agent A
Code harness
Agent B
Research harness
Agent C
Domain specialist

The moving point is context: a validated result or shared state crossing from one harness to another under one policy layer — instead of being copy-pasted between walled gardens.

The one-line diagnostic

A better prompt cannot compensate for a missing capability.

— triage heuristic, agent architecture

But prompting is still part of the solution

The heuristic is about ordering, not dismissal. Prompt engineering is real and valuable — it shapes how well the model uses what the harness exposes. It just cannot create what the harness never exposed.

The right sequence: fix the layer first (add the tool, the gate, the route, the policy), then tune the prompt to use that capability well. Prompting on top of a broken stack is polish on a cracked foundation.

Field use

Four questions before you rewrite the prompt

01

Loop failure

Agent “completes” without evidence
Is there a test, build, or validation that actually gates completion?
02

Graph failure

Wrong route, no fallback, dead-end
Are branches, retries, and handoffs explicit — or improvised every run?
03

Harness failure

Agent lacks tool, data, or permission
Does the environment expose what the task actually requires?
04

Meta-harness failure

Agents cannot share policy or context
Is there governance across your agent fleet, or N uncoordinated silos?
Why this sits under Mercury Core

The diagnosis. Then the substrate.

These four runtime layers are why a better prompt still fails when the harness is missing. Mercury Core is the operating system built as that harness and the meta-harness above it — one memory, one interface, one policy layer.

The five memory layers on Core are how the OS stores truth. OpenClaw is that fabric. The four layers on this page are how work is allowed to run.

A Booster Pack is how Core exposes a tool, a view, and a memory schema together — the harness, snapped in.

The loop on this page is the runtime gate: act, check, stop on evidence. Mercury Loop the product is a different thing: a managed service that keeps the OS from drifting away from the business.

When the gate is a model pass, Mercury Flux routes the cheapest capable model and stops on tests before anything ships.

Next step

Install the layers. Do not polish the prompt.

If the failure is missing tools, shared memory, or fleet policy, the next page is the operating system — not another prompt pack.

FAQ

Agent architecture FAQ

What are the four layers of an agent system?

Loop, graph, harness, and meta-harness. The loop verifies work against external evidence. The graph decides where execution goes next. The harness is the model's operating environment — tools, permissions, memory, context, logging. The meta-harness governs many harnesses so context and policy can move between agents instead of being copy-pasted.

Why do AI agents fail even with a good prompt?

Because prompting cannot create what the harness never exposed. If the stop condition, route, tool, or shared policy is missing, the model can still reason correctly and the run still fails. Diagnose the layer first, then tune the prompt.

Is an agent loop the same as Mercury Loop?

No. An agent loop is a runtime pattern: act, check, stop on evidence. Mercury Loop is a managed service that deploys Entry, Analyst, and Implementer agents to find and close infrastructure drift. Same word, different product.

How does this relate to Mercury Core and OpenClaw?

OpenClaw is Mercury Core's five-layer hierarchical memory — how the OS stores truth. These four runtime layers are how work is allowed to run. Core is built as the harness and the meta-harness: humans and agents share memory, interface, and policy. A Booster Pack snaps a tool, a dashboard, and a memory schema into that harness.

Why can't a better prompt fix a missing tool?

Prompting shapes how well the model uses what the harness exposes. It cannot create a tool, permission, data source, or policy the environment never offered. Fix the layer first, then tune the prompt.

What is a meta-harness?

The common layer above multiple agent environments. Teams already run Claude Code, Codex, internal agents, and specialists side by side. Without a meta-harness, each is a walled garden. With one, they share policy, isolation, and portable context. That is the Mercury Core thesis: stop using humans as the integration layer.

How do you diagnose which agent layer failed?

Ask four questions before rewriting the prompt. Loop: is there a test that gates completion? Graph: are branches and handoffs explicit? Harness: does the environment expose the tool, data, or permission the task needs? Meta-harness: can agents share policy and context, or are they N uncoordinated silos?
Definitions

Agent architecture terms used on this page

Agent loop
Act, check, stop on external evidence. Not Mercury Loop, the managed service.
Agent graph
Explicit routes, retries, specialist handoffs, fallbacks, and shared state.
Agent harness
The model's operating environment: tools, permissions, memory, context, logging.
Meta-harness
Governance across many harnesses — shared policy and portable context. Mercury Core's job.

Published 2 September 2026. Concept distilled from public discussion on agent architecture (Rishi, @RishiUvaach). Frame and implementation: Mercury Technology Solutions.