Skip to content
RobotWorld
Back to Blog
LongHorizon-Harness: Advancing Long-Horizon Agents for Real-World Tasks
长程智能体agent harnessMEA 循环

LongHorizon-Harness: Advancing Long-Horizon Agents for Real-World Tasks

AMAP-ML's LongHorizon-Harness turns long-horizon execution into independently audited state transitions via a Manage-Execute-Audit loop, lifting WeaveBench PassRate 51.8→80.7 with the same backbone.

Ziyu Ma 等(AMAP-ML / DreamX)August 23, 202615 min read
中文

Introduction

A long-horizon task is ultimately solved as a series of subtasks, yet the right decomposition cannot be fixed in advance: the next subtask depends on what has actually happened in the environment so far. Most existing agent harnesses nevertheless keep a whole long-horizon task in one continuously growing session, where step-level execution competes with long-term coordination, and progress is judged inside the very session that produced it.

LongHorizon-Harness, released by AMAP-ML (the DreamX team), takes the opposite stance: it keeps the task state as an explicit record outside execution, admits only independently verified facts into that record, and derives each next subtask from it. The result is a Manage–Execute–Audit (MEA) loop of independently audited state transitions — and, with the exact same backbone model and execution backend, large gains on every benchmark tested: WeaveBench PassRate jumps from 51.8% to 80.7%, OSWorld 2.0 binary completion improves by 3.0× (2.8% → 8.3%), and Terminal-Bench 2.1 success rises from 69.7% to 77.2%.

Two panels side by side: left, a single growing session coils back on itself, judging its own progress and drifting; right, a manager re-plans the next subtask from audited facts, a fresh-context executor performs it, and a read-only auditor certifies what actually changed.
Audited state transitions. Instead of one continuously growing session that judges its own progress (left), a manager re-plans the next subtask from audited facts, a fresh-context executor performs it, and a read-only auditor certifies what actually changed in the environment (right). Audit reports are the only cross-round memory.

Why Single-Session Execution Fails

The authors identify three failure modes that all trace back to the same architectural choice — coupling execution, state, and self-assessment in one growing context:

Compounding errors

An early mistake distorts every choice made after it, and the agent drifts away from the goal it started with.

Context rot

As the history grows, what matters gets harder to retrieve, and performance falls off sharply once context use crosses a threshold.

Task-state loss

There is no accurate record of what is done, what was produced, and what the environment actually contains, so progress cannot be resumed.

Once an unverified premise enters the record, every later decision inherits it. Existing harnesses never separate progress assessment from execution: a subagent reports a summary of its own work, and review is an optional action rather than a mandatory gate. Unverified premises accumulate and lead to repeated attempts, goal drift, or premature termination. An audit gate removes that failure at its root.

Core Idea: Keep the Goal Fixed, Ground Every Decomposition in Audited Facts

LongHorizon-Harness therefore replaces the single growing session with a loop over three separated roles, so the task is decomposed dynamically and every decision is grounded in independently verified facts rather than self-reports. The design rests on four pillars:

  • P1 · Dynamic decomposition, fixed goal. Every round, the manager reads what has been verified as done, which constraints remain active, and what is still missing, then derives the next subtask with its target, dependencies, boundaries, and acceptance criteria.
  • P2 · Audit-grounded progress. Only a read-only auditor can update the record. It inspects the real environment after each round and never sees the executor’s reasoning or self-assessment, so a fact is completed only when an audit report cites it.
  • P3 · Round-local execution. A fresh-context executor performs the single current subtask and discards its context afterwards. Only compact audit reports cross rounds, so dense step-level observations never reach long-term coordination.
  • P4 · Reset without amnesia. An execution error is either exposed by the next audit or never enters the record, so it stays confined to its round. The audit report separates what remains trustworthy from what must be repaired.

Method: Three Structurally Isolated Roles, One Audited State Machine

LongHorizon-Harness preserves the native agent loop of existing systems. A lightweight AgentAdapter lets Claude Code, Codex CLI, OpenClaw and Hermes Agent serve as interchangeable backends for all three roles, spanning models such as Claude Opus, GPT and Qwen — a different model per role, assigned by configuration alone. Each role has its own budget: 1800 s per round for the executor, 300 s for the manager and auditor, under a cap of 25 MEA rounds per task.

Overview of LongHorizon-Harness: the manager emits a subtask contract, the executor performs the state-changing action in a fresh context, and the auditor appends a read-only report to the chain.
The MEA pipeline. The manager emits a subtask contract, the executor performs the state-changing action in a fresh context, and the auditor appends a read-only report to the chain of audited state transitions.

Manager (M)

Keeps the task state: every requirement, artifact and environment fact, each marked completed, pending, blocked or untrusted, together with the audit evidence behind that status. A record becomes completed only when an audit report supports it. Each round it reads that state and decides whether to run another subtask, finish, declare the task blocked, or ask the user.

Executor (E)

The only module allowed to change the environment. It receives one subtask and the evidence that subtask depends on, and starts from a fresh context every time; its raw trajectory and reasoning are discarded afterwards. Whether it works through the GUI or the command line follows the change being made, not what tools it happens to hold.

Auditor (A)

Checks the result independently, from a context that never sees the executor’s trajectory or reasoning. It may follow the executor’s report to find the outputs, but it decides completion by inspecting the environment itself against the acceptance criteria, and records what it verified, what is still unresolved, and the evidence for each conclusion.

Read-only integrity

Auditing is restricted to read-only interaction, so verification cannot alter the result under inspection. The harness monitors task-relevant artifacts and workspace contents while an audit runs; if the auditor modifies protected state, its report is marked an integrity violation and can no longer support a completed record.

One Round of the MEA Loop

Each round applies three operators in sequence: state transition (manage), state-changing action (execute), and state capture (audit). The auditor’s report from round i feeds the manager’s decision in round i+1, which in turn shapes the executor’s context in that same round. Concretely, one round has six steps:

  1. Manager reads the record. It takes the original task, the current task state, and every audit report gathered so far.
  2. Apply the verified findings. Confirmed changes add or update requirement, artifact and fact records; anything unresolved stays pending, blocked or untrusted. Nothing is marked completed without audit evidence.
  3. Emit one contract. The manager picks an unresolved objective reachable from the current state and bounds it: goal, acceptance criteria, boundary constraints, and the prior audit evidence relevant to doing and checking it.
  4. Executor acts, then forgets. It starts from a fresh context holding only what this round supplies, changes the environment, and reports what it did. Its raw trajectory is then discarded.
  5. Auditor captures the state. It inspects the environment through read-only tools against the contract’s criteria. The executor’s report may guide where to look, but cannot establish completion.
  6. Continue, or stop. The manager returns done when the audited state satisfies the task, blocked when nothing feasible advances it, ask when it needs user input, otherwise execute with the next contract — up to 25 rounds.

Benchmarks: Three Long-Horizon Axes of Difficulty

The harness is evaluated on WeaveBench, OSWorld 2.0, and Terminal-Bench 2.1, covering cross-interface coordination, long-horizon state management under realistic professional complexity, and pure CLI competence. Runs use Qwen 3.7-Plus as the primary backbone and Claude Opus 4.7 for the backbone-generality study.

WeaveBenchOSWorld 2.0Terminal-Bench 2.1
Scale114 tasks across 8 domains108 tasks, median 1.6 h for a humanHard CLI tasks, 3 runs each
InterfaceGUI and CLI in one trajectoryDesktop GUI, 1920×1080CLI only — no visual perception
ScoringTrajectory-aware agentic judge; PassRate counts tasks scoring ≥ 0.8Native env.evaluate(); binary and partialPer-task pass/fail, averaged over runs
EnvironmentContainerized VM, frozen snapshot, restricted networkOfficial osworld-v2-2026.06.24 Docker VMHarbor on the Docker backend
What it testsWhether evidence gathered in one interface survives into anotherWhether task state survives an hour-long professional workflowThe state-management layer alone, with GUI routing removed

Results: Consistent Gains Across Benchmarks and Backbones

With the same backbone and the same execution backend, LongHorizon-Harness lifts WeaveBench PassRate from 51.8% to 80.7%, OSWorld 2.0 binary completion by 3.0×, and Terminal-Bench 2.1 success from 69.7% to 77.2%. The gains carry over from Qwen 3.7-Plus to Claude Opus 4.7.

Table 1 · WeaveBench results (114 tasks). PR denotes PassRate (%), Overall the mean per-task score; DSK/DOC/GAM/WEB/DAV/OPS/SPA/DES are the eight domains.

AgentHarnessPR ↑Overall ↑DSKDOCGAMWEBDAVOPSSPADES
Claude Opus 4.7Claude Code41.20.53255.647.123.553.323.150.033.340.0
Claude Opus 4.7OpenClaw35.10.48255.629.423.566.715.441.716.720.0
Claude Opus 4.7Hermes Agent28.10.51633.347.111.826.730.850.08.310.0
Claude Opus 4.7Codex CLI13.20.37816.711.811.86.77.725.016.710.0
GPT-5.5Codex CLI35.10.49938.929.423.553.315.450.058.310.0
GPT-5.5OpenClaw33.30.46638.935.335.321.423.138.533.340.0
GPT-5.5Hermes Agent31.60.46655.629.435.340.07.725.025.020.0
GPT-5.5Claude Code14.90.29933.311.811.80.015.416.725.00.0
GPT-5.4OpenClaw22.80.46555.635.35.90.023.123.18.320.0
GPT-5.3-codexOpenClaw18.40.45633.323.529.40.07.716.78.320.0
GPT-5.2-codexOpenClaw6.10.3215.611.80.00.015.416.70.00.0
GPT-5.1-codexOpenClaw1.80.2260.05.90.00.07.70.00.00.0
Gemini 3.1 proOpenClaw1.80.2230.00.00.00.00.08.38.30.0
Qwen3.5-397B-A17BOpenClaw0.90.3180.00.00.00.00.08.30.00.0
Qwen3-VL-8B-ThinkOpenClaw0.90.0920.00.00.00.08.30.00.00.0
GUI-Owl-1.5-32BOpenClaw0.00.0650.00.00.00.00.00.00.00.0
Qwen 3.7-PlusClaude Code (baseline)51.80.70283.376.529.446.753.866.716.720.0
Qwen 3.7-PlusLongHorizon-Harness (ours)80.70.83588.9100.058.873.384.691.766.780.0
Change vs. the same backbone on bare Claude Code+28.9+0.133+5.6+23.5+29.4+26.6+30.8+25.0+50.0+60.0

The first 16 rows are official results reported by WeaveBench (best thinking mode per backbone). All eight domains improve and DOC reaches 100.0. Note that the authors’ runs execute the agent with root privileges inside the task VM, whereas the official baselines run under a regular user account, so the official rows are reference points rather than strictly matched comparisons.

Terminal-Bench 2.1 leaderboard: LongHorizon-Harness with Codex and GPT-5.6 Luna reaches 83.1%, and with Claude Code and Qwen 3.7-Plus reaches 77.2%, up from the 69.7% baseline.
Terminal-Bench 2.1 official leaderboard. LongHorizon-Harness retains Claude Code as its executor backend and improves success rate from 69.7% to 77.2%; with Codex and GPT-5.6 Luna it reaches 83.1%. Values marked with * are externally reported metrics.

Table 2 · OSWorld 2.0 (108 desktop workflows). Binary is the percentage of tasks whose final benchmark score equals 1; Partial is the mean benchmark score over all 108 tasks.

AgentHarness / ModeBinary ↑Partial ↑
Claude Opus 4.8Batched actions20.654.8
Claude Opus 4.7Batched actions18.248.9
GPT-5.5Batched actions13.049.5
Claude Opus 4.8Single action18.549.3
Claude Opus 4.7Single action13.949.1
Claude Sonnet 4.6Single action8.341.5
MiniMax M3Single action4.622.3
Kimi 2.6Single action4.622.1
Qwen 3.7-PlusSingle action (baseline)2.821.5
Qwen 3.7-PlusLongHorizon-Harness8.335.2

Table 3 · OSWorld 2.0, Opus 4.7 subset (34 tasks).

AgentHarness / ModeBinary ↑Partial ↑
Claude Opus 4.7Single action20.655.8
Claude Opus 4.7LongHorizon-Harness35.366.9

Swapping only the harness lifts binary completion by +14.7 points and partial score by +11.1, so the gains are a property of the framework rather than of one backbone. The backbone still decides the quality of each round’s actions, while the harness decides how reliably verified outcomes survive between rounds — that is why the two compound instead of substituting for each other.

Two scatter panels of OSWorld 2.0 binary completion and partial score against output tokens per task. A blue star marks LongHorizon-Harness with Qwen 3.7-Plus, reached by a dashed arrow from the single-action baseline.
Cost–performance frontier on OSWorld 2.0. Binary completion (left) and partial score (right) versus average output tokens per task. Colored curves show the official results under different reasoning-effort settings, with marker size indicating the reasoning effort. The blue star denotes LongHorizon-Harness with Qwen 3.7-Plus, and the dashed arrow shows its improvement over the official single-action baseline.

Cost & Attribution: Coordination Is Cheap

The manager accounts for only 2.8% (WeaveBench), 2.0% (OSWorld 2.0), and 8.1% (Terminal-Bench 2.1) of total tokens. Auditing is the larger investment at 19.4%, 24.8%, and 38.1% respectively. And overall cost is not uniformly higher: on Terminal-Bench 2.1 the harness consumes 24% fewer tokens than the baseline while gaining 7.5 points.

Stacked bars of tokens per task on WeaveBench, OSWorld 2.0 and Terminal-Bench 2.1, split into manager, executor and auditor shares against the baseline agent.
Where the tokens go. Average tokens per task consumed by the manager, executor, and auditor in LongHorizon-Harness, compared with the corresponding baseline. Segment labels report the fraction consumed by each role. All LH-Harness roles use Qwen 3.7-Plus. WeaveBench and Terminal-Bench 2.1 report total tokens; OSWorld 2.0 reports output tokens because the official results provide only output-token statistics.

Two findings sharpen the attribution:

  • Overhead is not intrinsic (−33%). On the 17 Games tasks the same framework inverts sign by backbone: Opus 4.7 spends 33% fewer tokens (16.5M → 11.1M) while scoring higher, whereas Qwen 3.7-Plus spends 3.2× more (10.7M → 34.3M). A stronger backbone satisfies a contract in fewer audit–replan rounds.
  • Capability is a system property (0.733 vs 0.680). On those same tasks, Qwen 3.7-Plus under the harness reaches 0.733, above the 0.680 that Opus 4.7 reaches on bare Claude Code. A harness cannot add primitive capability, but it decides how much of it survives to the end of the task.
Three dumbbell panels comparing baseline and LongHorizon-Harness across WeaveBench domains, OSWorld 2.0 capability tags and Terminal-Bench 2.1 categories, with the point change listed at the right of each panel.
Where the gains come from. LongHorizon-Harness (blue) is compared with the same-model baseline (gray) across WeaveBench domains (left), OSWorld 2.0 capability tags (middle), and Terminal-Bench 2.1 categories (right). The rightmost column of each panel reports the absolute performance change in points. Blue connectors indicate improvements, red connectors indicate regressions. Parenthesized values report the number of OSWorld tasks or Terminal-Bench trajectories in each category.

Insights: Four Recurring Patterns in Paired Trajectories

The authors compare paired trajectories in which the Claude Code baseline and LongHorizon-Harness execute the same task using the same Qwen 3.7-Plus model. These cases examine what persists between rounds under the MEA loop.

Case 1 · Recovering from a stalled interaction (0.59 → 0.92)

WEB_task_16 · WebRTC simulcast layer audit. The baseline does notice the failed GUI interaction, but the observation stays buried in its growing execution history, so it retries the same interaction for 400+ steps. The harness writes the stall and the unresolved evidence gaps into the task state, so recovery resumes from the latest audited state rather than from the failed trajectory. Concretely, Wireshark’s “Decode As” dialog stops responding; the baseline degenerates into 400+ steps of repeated clicking, while the auditor rewrites the same difficulty into concrete evidence gaps, and the next round targets only the unmet items.

WEB_task_16 storyboard: the baseline loops on an unresponsive Wireshark dialog while LongHorizon-Harness rewrites the failure into evidence gaps.
Case 1: the baseline loops on an unresponsive Wireshark dialog; the harness converts the stall into evidence gaps and re-plans around them.

Case 2 · Auditing apparent completion (0.00 → 0.89)

DOC_task_2 · Heading style normalization. The executor stops at a visually plausible result that misses the specification: the baseline edits the document XML directly, and the task requires the LibreOffice workflow, so it scores 0.00. The auditor re-parses the XML instead, keeping a plausible but non-compliant claim out of the task state. The baseline advances the document’s appearance through direct ODT XML edits and treats “looks right” as done; re-parsing the XML turns completion into an independently checkable claim.

DOC_task_2 storyboard: the baseline edits ODT XML directly and treats looks-right as done, while the auditor re-parses the XML.
Case 2: direct ODT XML edits pass the eye test but fail the judge; the auditor’s re-parse catches the non-compliant shortcut.

Case 3 · Preserving pre-repair evidence (0.45 → 0.87)

DOC_task_4 · Calc VLOOKUP repair. Part of the required evidence belongs to the state before the repair. The baseline modifies the spreadsheet before that sequence is complete, leaving an inconsistent before-and-after record. Recording the gap as a pending requirement changes the order of work: the original state is documented before the repair may touch it. The baseline does fix the spreadsheet, but its direct-XML repair destroys the original error scene, so its “before” screenshots show post-fix state; the harness locks the pre-repair window first, then audits all nine screenshots for consistency.

DOC_task_4 storyboard: the baseline repair erases the pre-fix forensic context; the harness locks the evidence window down first.
Case 3: the harness locks the pre-repair evidence window before any fix is allowed to touch it.

Case 4 · Continuing from verified progress (0.53 → 0.85)

WEB_task_10 · Lighthouse performance drill. Both systems can perform the core optimization; they differ in maintaining the rest. The baseline improves the page, but the same session must also drive DevTools, track deliverables and judge its own progress, and the budget runs out. Keeping finished work outside the execution history lets fresh executors spend context on what remains, while the manager maintains continuity across the whole workflow.

WEB_task_10 storyboard: the baseline lands the core optimization but burns its budget in DevTools; the harness phases the work across roles.
Case 4: the baseline lands the core optimization but burns its budget in DevTools; the harness phases the work across roles.

Takeaway

Long-horizon capability is a property of the whole model–harness system, not of the model alone. The backbone decides what an agent can do within a single round; the harness decides how much of that survives to the end of the task. That is why the same loop lifts a weaker backbone above a stronger one running bare, and why it cannot help where a task turns on a capability the model simply lacks.

Try It Yourself

The harness is distributed as a Python package (Python 3.10+) and needs one agent runtime on PATH: claude, codex or openclaw.

uv tool install lh-harness   # or: pip install lh-harness

lh-harness run --task "Summarise the files in this directory." \
  --agent claude_code --model qwen3.7-plus --max-rounds 2

Add --dashboard to watch the MEA loop live, or --task @task.md to read the task from a file. Each run is isolated under runs/<run-id>/ with its full audit trail.

Citation

@article{longhorizonharness2026,
  title={LongHorizon-Harness: Advancing Long-Horizon Agents for Real-World Tasks},
  author={Ziyu Ma and Hailang Huang and Shun Zou and Yong Wang and Shidong Yang and Yiming Hu and Fei Wei and XiangXiang Chu},
  journal={arXiv preprint arXiv:2608.01964},
  year   = {2026},
  url    = {https://arxiv.org/abs/2608.01964}
}

Source: This article is adapted from the LongHorizon-Harness project page at https://lh-harness.pages.dev/ (AMAP-ML / DreamX team). Paper: arXiv:2608.01964 · Code: github.com/AMAP-ML/LongHorizon-Harness

Source:AMAP-ML 项目主页https://lh-harness.pages.dev/