Evaluating LLM Agents: From Long-Horizon Tasks to Engineering Reliability

    This article explains how to evaluate LLM-based agents beyond single-turn QA scores. It covers why long-horizon tasks require dedicated evaluation, the core metrics (task completion, tool-call correctness, context retention, shell execution reliability, error recovery, cost and latency), how to build reproducible shell benchmarks, how to measure self-correction, how to read composite improvement claims, how priorities differ across work, coding, and chat scenarios, and what infrastructure a large-scale evaluation pipeline needs. It is written for engineers and researchers who design or interpret agent evaluations.

    Large language models are evolving from tools that simply generate text into agents that can plan tasks, call tools, and verify their own results. Evaluating these systems with single-turn QA scores alone is no longer sufficient. This article is for engineers and researchers who need to design or interpret agent evaluations. It explains which dimensions an evaluation should cover, how to define each one, and what to verify when citing public benchmark data. The focus is on evaluation methodology, not training data construction.

    Why Long-Horizon Tasks Need Dedicated Evaluation

    Static benchmarks are mostly single-turn QA with fixed answers. They work well for testing knowledge and basic reasoning, but they say little about how an agent behaves in a real workflow. Long-horizon tasks typically involve dozens of steps, tool errors along the way, mid-task user clarifications, and decisions that need to be revisited. Three failure modes are common in these settings: the instruction gradually drifts from the original goal over multiple turns, early information is forgotten as the context grows, and the model calls nonexistent parameters or fabricates tool outputs. These problems barely appear in single-turn tests, which is why long-horizon evaluation must treat the complete session as the basic unit.

    The provenance of evaluation samples also needs to be stated. Sample sources, task types, filtering rules, and the collection time window all affect conclusions. If a report gives only a total session count without explaining where the data came from or how it was filtered, readers cannot judge whether the results generalize to their own use cases.

    Evaluation Dimensions

    A reasonably complete agent evaluation usually includes the following dimensions:

    • Task completion rate: whether the final goal is achieved. “Done” must be defined in advance.
    • Tool-call correctness: whether parameter formats, call ordering, and use of returned results are correct.
    • Context retention: whether early constraints are still followed after many turns.
    • Shell execution reliability: whether generated commands run correctly in the target environment.
    • Error recovery: whether the model adjusts its strategy after receiving feedback or hitting errors.
    • Cost and latency: the token count, elapsed time, and number of calls needed to complete a task.

    These dimensions do not always move together. A model may achieve a high completion rate while consuming far more calls per task, driving real-world cost up. An evaluation report should therefore present multiple dimensions rather than collapsing everything into a single score.

    Shell Command Execution Reliability

    Shell reliability measures the degree to which agent-generated commands execute as intended in a specified environment. Before measuring it, the environment must be fixed. OS version, shell type, dependency versions, user permissions, working directory structure, and network access rules should all be documented. The same command can produce different results in different environments, so success rates are not comparable unless the environment is pinned.

    Running tests inside isolated containers is recommended. Restore the initial snapshot before each task and inspect file changes afterward, so that runs of different models do not interfere with each other. Success criteria should be written down in advance. For example: a command counts as successful only if the exit code is zero and the output file matches expectations. A nonzero exit code followed by the agent correctly reading the error and fixing the issue counts as a “recovery success” and should be tracked separately.

    Side-effect control matters just as much. Even if a command accomplishes its goal, it should be scored as a failure or risk event if it deletes unrelated files, changes permissions, or consumes excessive resources. Evaluations can define whitelisted directories and raise alerts on out-of-bounds writes.

    Exception capture rate measures whether the agent can identify the true cause from stderr after a command fails. Automated judgment tends to miss incorrect repair reasoning, so this metric requires manual spot-checking.

    Course Correction and Error Recovery

    Error recovery is about what happens after failure. A common bad pattern is the model retrying the same code repeatedly, changing only irrelevant whitespace or variable names. A competent agent should go through this loop: execution fails, it reads the error message, diagnoses the cause, proposes a fix, and verifies again.

    Here is a simplified example. The agent needs to run a data-cleaning script. The first run errors out, reporting that a column name does not exist. A weak response ignores the error and resubmits the script unchanged. A strong response prints the header first, discovers the column name differs only in capitalization, fixes the matching logic, reruns the script, and checks whether the output row count meets expectations.

    To evaluate this capability, you can deliberately inject faults into the environment, such as returning incomplete data or wrong status codes, and observe whether the model detects the anomaly. The injected faults should cover multiple types, so the model is not merely reacting to one fixed error format.

    How to Read a Composite Improvement Metric

    Public evaluations often claim that “model X improves over its predecessor by N percentage points.” Before trusting such a number, confirm the following:

    1. The metric formula: numerator, denominator, and whether any weighting is applied.
    2. The comparison baseline: which previous model generation is used, and whether both were tested on the same tasks and the same evaluation version.
    3. Sample size and confidence intervals: with small samples, a few percentage points of difference may be random noise.
    4. Measurement conditions: sampling temperature, tool permissions, and maximum turn limits.

    If any of this information is missing, treat the number as a directional signal rather than a basis for model selection. When citing it, note the source and date, and avoid conclusive phrasing such as “consistently ranks at the top” unless readers can verify the ranking methodology themselves.

    Priorities Across Scenarios

    Agent tasks generally fall into three scenario categories—work, coding, and chat—each with different metric priorities.

    Work scenarios focus on information retrieval, process automation, and document generation. Core metrics include completeness of task decomposition, accuracy of long-text extraction, and data consistency across system calls. Typical failures: skipping a step, or misusing a field from one system in another.

    Coding scenarios focus on code generation, review, refactoring, and debugging. Core metrics include test pass rate, whether the modification scope is reasonable, and adherence to existing code style. Typical failures: fixing an error while introducing a new logic bug, or modifying the tests themselves just to make them pass.

    Chat scenarios focus on multi-turn consistency, context understanding, and safety boundaries. Core metrics include persona and constraint retention, appropriate handling of sensitive requests, and whether answers remain consistent with earlier conversation after long dialogues. A typical failure: gradually forgetting constraints the user set at the start of a long conversation.

    Evaluation samples should be built separately for each scenario; a single averaged score should not stand in for all of them.

    The Role of Infrastructure in Evaluation

    Large-scale agent evaluation places real demands on compute resources. Many tasks must run concurrently, and each may need its own container environment, storage, and logging. This kind of workload typically relies on foundational capabilities provided by general cloud platforms or private clusters: container orchestration, object storage, logging services, and monitoring with alerting.

    Container orchestration assigns an isolated environment to each task so different models run under identical conditions. Object storage is well suited for test sets, environment snapshots, and complete interaction records. Logging and monitoring capture inference latency, resource consumption, and failure causes for later analysis. Which platform to choose depends on the team’s existing tech stack, data compliance requirements, and budget. These capabilities are offered by multiple vendors; there is no single standard solution.

    Implementation Recommendations and Boundaries

    To build an internal agent evaluation, you can proceed as follows. First, define task completion criteria and write them as rules that can be checked automatically. Second, pin the evaluation environment and record version information. Third, build a task set covering both normal and exceptional paths, and keep a sample for manual review. Finally, report multiple dimensions together, along with sample size, time window, and measurement conditions.

    This approach has clear boundaries. Automated judgment rules can have loopholes, manual review is expensive, and public leaderboard task distributions may not match your specific business. Evaluation results are therefore best used to compare the relative performance of candidate models, and should be combined with small-scale pilots to confirm real-world effectiveness. Provided that data, compliance, and cost conditions are met, agents are well positioned to take on more execution-oriented work—but every business scenario still needs its own validation.