Evaluating Long-Horizon Agent Tasks: From Metric Design to Blind Testing

    Long-horizon agent tasks require evaluation at the session level rather than the message level. This article explains how to define task boundaries, design a core metric system covering task completion, shell command reliability, error recovery, efficiency, and result quality, and organize blind tests with pairwise comparison. It also shows how to compute net win rate from comparison results, handle statistical significance with bootstrap confidence intervals, avoid common evaluation pitfalls, and build an internal evaluation pipeline.

    Why Long-Horizon Tasks Need Dedicated Evaluation

    Single-turn QA evaluation typically checks only whether an answer is correct. Agents work differently: they plan steps across multiple turns, invoke tools, read returned results, and decide the next action based on intermediate states. A single task may last tens of minutes and involve dozens of tool calls. In this setting, the quality of any single response does not represent overall performance. A plan can be sound at every step, yet still veer off target at step fifteen because the output format of one command was parsed incorrectly.

    The unit of evaluation should therefore be the complete task session, not an individual message.

    Define Task Boundaries First

    Before evaluation begins, “good performance” must be translated into verifiable conditions. A common approach is to divide tasks into three categories:

    1. Work tasks: document organization, data aggregation, workflow automation, and similar work. The focus is whether the deliverable meets the requirements.
    2. Programming tasks: reading a code repository, modifying the implementation, and running tests. The focus is test pass rates and the scope of changes.
    3. Conversational tasks: multi-turn clarification, requirement probing, and information retrieval. The focus is comprehension accuracy and consistency of responses.

    Each category should specify the input content, permitted tools, judgment criteria, and timeout rules. Evaluations with unclear boundaries produce results that are hard to compare across systems.

    The Core Metric System

    At minimum, cover the following dimensions:

    • Task completion rate: the proportion of tasks that meet the judgment criteria within a limited number of steps.
    • Shell command execution reliability: the proportion of commands with correct syntax, reasonable parameters, and correctly interpreted results. When counting, distinguish two cases: correct recovery after a command failure, versus continuing with erroneous operations after a failure.
    • Course correction and error recovery: when the user modifies requirements mid-task or the environment returns anomalies, whether the agent adjusts its plan promptly while preserving valid work already completed.
    • Process efficiency: number of tool calls, proportion of repeated operations, and total elapsed time.
    • Result quality: scores assigned by reviewers against a predefined rubric.

    These metrics can constrain one another. For example, an overly cautious strategy may improve the recovery score while hurting process efficiency. Weights should be determined by the business scenario, not fixed in advance.

    Organizing Blind Tests

    The purpose of blind testing is to eliminate reviewer bias about where each solution comes from. Key points in practice:

    1. Hide the source: content shown to reviewers should be stripped of model names, version numbers, and interface characteristics.
    2. Randomize position: in pairwise presentations, randomly assign the left-right order to avoid position effects.
    3. Fix the rubric: all reviewers use the same criteria; no new criteria may be added after the fact.
    4. Record disagreements: samples where reviewers disagree should be flagged separately as clues for refining the criteria.

    The advantage of pairwise comparison is that reviewers only need to judge “which is better,” which is more stable than absolute scoring. To convert a large set of pairwise results into a ranking, you can use the Bradley-Terry model or Elo-style methods. These methods assume each solution has a latent strength value and that win probability is determined by the difference in strength, making them well suited for estimating relative rankings.

    From Comparison Results to a Composite Metric

    The core of a composite metric is converting win-loss relationships into interpretable numbers. A simple option is net win rate:

    Net win rate = (wins − losses) / valid samples

    Ties count toward the denominator but not the numerator. The metric ranges from -1 to 1, making it easy to compare across batches. Samples that timed out due to environment failures should be marked invalid, with the cause recorded separately.

    The following example shows how to compute net win rate while excluding invalid samples:

    1. from dataclasses import dataclass
    2. @dataclass
    3. class Verdict:
    4. task_id: str
    5. outcome: str # "A_win", "B_win", "tie", "invalid"
    6. def net_win_rate(verdicts: list[Verdict]) -> float:
    7. valid = [v for v in verdicts if v.outcome != "invalid"]
    8. if not valid:
    9. raise ValueError("No valid samples; cannot compute net win rate")
    10. wins = sum(1 for v in valid if v.outcome == "A_win")
    11. losses = sum(1 for v in valid if v.outcome == "B_win")
    12. return (wins - losses) / len(valid)

    Sample Size and Statistical Significance

    Whether a difference is credible depends on sample size and variance. Recommended practices:

    • Prepare hundreds of samples per task category, so conclusions are not decided by a handful of tasks.
    • Run the same task multiple times to observe variance in the results.
    • Report confidence intervals rather than a single number. You can use the bootstrap method—resampling tasks with replacement—to estimate the interval range.
    • When the gap between two solutions is smaller than the statistical error, the conclusion should be stated as “indistinguishable.”

    For example, if the 95% confidence interval of the net win rate crosses 0, you cannot conclude that either side is better.

    Common Pitfalls

    1. Looking only at averages. Averages can hide severe failures in a particular task category. Report results separately by category.
    2. Overlap between the evaluation set and training or tuning data. This inflates results and destroys their reference value.
    3. Ignoring environment differences. Tool versions, permission settings, and network conditions all directly affect results. The evaluation environment should be containerized with pinned versions.
    4. Treating metrics as the sole objective. When a team optimizes only one metric, that metric gradually loses representativeness. Periodically replace part of the sample set.

    Implementation Recommendations

    Building an internal evaluation pipeline can be done in four steps:

    Step 1: Collect real tasks, remove sensitive information, and build a task library.

    Step 2: Write judgment rules and scoring rubrics for each task.

    Step 3: Implement automated execution and log retention, preserving every tool call and its returned results.

    Step 4: Publish evaluation reports weekly or per version, including per-category metrics, confidence intervals, and representative failure cases.

    Representative failure cases guide improvement better than aggregate scores. Teams should classify failure causes into fixed categories—such as parameter errors, state loss, and goal drift—and track how each category trends over time.