Terminal Agent Evaluation: How to Measure a Model's Autonomous Engineering Capabilities

    This article explains how evaluation is shifting from single-answer coding tests to terminal-based tasks that measure a model's autonomous engineering ability. It covers the structure of terminal tasks, the capability dimensions worth measuring (planning, tool use, error recovery, code modification and verification, long-context retention, and boundary/safety), a minimal evaluation loop with pseudocode, pitfalls when reading public benchmark results, and a practical path for engineering teams to build their own internal evaluation.

    1. From Q&A to Tasks: The Shift in Evaluation

    The common way to evaluate code models in the past was to pose a single problem, have the model write a function, and then judge correctness with unit tests. This works for algorithm problems and code completion, but it fails to cover most of what engineering work actually involves. Real engineering tasks often have no clear input/output boundaries, and the requirements are described vaguely. Developers first need to locate the problem, read the surrounding context, run commands, inspect logs, then modify the code step by step, and finally verify the result.

    A new class of evaluation places the model inside a terminal environment and gives it only a goal, for example “make a service’s startup flow pass in a clean environment.” The model can run commands, read and write files, install dependencies, and run tests. The evaluation focuses on whether the final state meets the requirements, while also recording planning quality, tool-use efficiency, and error-recovery ability.

    This paradigm has three core changes. The evaluation target shifts from the “answer” to “process plus result.” The input shifts from precise specifications to vague goals. The judging method shifts from text comparison to inspecting the state of the environment.

    2. The Basic Structure of a Terminal Task

    A complete terminal task usually contains four parts.

    1. Initial environment: includes a code repository snapshot, dependency declarations, configuration files, and available command-line tools. The environment version must be fixed, otherwise results cannot be reproduced.
    2. Task description: states the goal in natural language. The description can retain a degree of vagueness to test whether the model proactively seeks clarification or makes reasonable assumptions.
    3. Action interface: the model can only interact with the environment through a restricted command-execution interface. The output of each command is returned to the model as the basis for the next decision.
    4. Judging program: after the task ends, an independent script checks the state of the environment, for example whether tests pass, whether file contents match the agreed convention, and whether the service can respond to requests normally.

    The design of the judging program is the most critical. If the judgment relies only on the model’s self-report, the result is easily distorted. The reliable approach is to write the acceptance criteria as executable checks, run them in an independent process, and isolate them from the model’s execution environment.

    3. Capability Dimensions the Evaluation Should Cover

    A single pass rate cannot tell the whole story. It is recommended to break results down into the following dimensions.

    3.1 Task Planning

    After receiving a vague goal, can the model break it into reasonable sub-steps and advance them in dependency order? You can record the model’s planning content before its first action, then compare it against the actual execution path and count the number of deviations. A correct plan with repeated execution failures and a plan that is itself wrong call for completely different improvements.

    3.2 Tool Use

    This dimension focuses on whether command selection is appropriate, whether parameters are correct, and whether ineffective commands are repeated. You can measure the proportion of invalid calls and the average number of steps. A high step count does not necessarily indicate poor ability, but aimless repetition is definitely a problem.

    3.3 Error Recovery

    This is the key metric that distinguishes ability. Given an error message, can the model accurately locate the root cause instead of blindly retrying or deleting files? You can artificially inject common errors into the environment, such as dependency version conflicts, port occupation, or insufficient permissions, then observe the model’s repair path.

    3.4 Code Modification and Verification

    After modifying code, does the model proactively run the relevant tests and adjust based on the results? Modifying code without verifying it should be treated as incomplete.

    3.5 Long-Context Retention

    After multiple rounds of interaction, does the model still remember constraints discovered early on? For example, if a certain configuration file is not allowed to be modified, is that constraint still respected at step forty?

    3.6 Boundary and Safety

    Did the model perform destructive operations unrelated to the task, such as deleting unrelated directories, rewriting version-control history, or sending data externally? Such behavior should be recorded as a failure, even if all tests ultimately pass.

    4. A Sample Self-Built Evaluation Framework

    The pseudocode below shows a minimal evaluation loop. It does not depend on any specific platform; its core principles are isolating the environment, limiting the number of steps, and judging independently.

    1. function run_episode(task, model, max_steps):
    2. env = create_isolated_sandbox(task.snapshot) # Create a clean environment from a fixed snapshot
    3. history = [task.goal]
    4. for step in 1..max_steps:
    5. action = model.next_action(history)
    6. if action.type == "finish":
    7. break
    8. if action.type == "shell":
    9. result = env.execute(action.command, timeout=task.cmd_timeout)
    10. history.append(action, result)
    11. log_trace(step, action, result)
    12. if env.violates_policy(action): # e.g., accessing a forbidden path
    13. return {status: "policy_violation", steps: step}
    14. passed = run_checks(env, task.checks) # Run acceptance scripts in a separate process
    15. env.destroy()
    16. return {status: "pass" if passed else "fail", steps: step, trace: history}

    A few points need attention during implementation.

    • The snapshot must be fixed. Each evaluation starts from the same state; otherwise results cannot be compared across batches.
    • Set timeouts per command to prevent a single long-blocking process from exhausting the overall budget.
    • Separate the identity of the acceptance scripts from the model’s execution, so the model cannot “pass” the tests by modifying the acceptance scripts.
    • The complete trace must be saved. Looking only at the pass rate cannot pinpoint the cause of failure; only the trace supports after-the-fact analysis.

    The design of the task set is equally important. It is recommended to include three types of tasks: routine bug fixes, cross-file feature additions, and environment/dependency problems. Each type should be graded by difficulty, and a portion of tasks should be kept private to prevent the model from having seen the answers in its training data.

    5. Cautions When Interpreting Public Results

    Public evaluation data helps you understand the overall industry level, but the following biases need attention when using it directly for selection.

    First, the test problems may already be in the training data. If the problems overlap heavily with the historical commits of public repositories, the score will be higher than the true ability.

    Second, scaffolding differences have a significant impact. The same model paired with different tool wrappers, prompting strategies, and retry mechanisms can differ by several percentage points. Before comparing, you must confirm that the evaluation conditions are consistent.

    Third, results have randomness. Running the same task multiple times can yield different results. A report should give the mean and the range of variation across multiple samples, not a single result.

    Fourth, cost and latency must be considered together. The highest-scoring approach is not necessarily suitable for production. The number of tokens consumed per task, the average time taken, and the unit cost should all be evaluated alongside accuracy.

    Fifth, verify the source of the results. Data released by the vendor itself usually lacks independent reproduction; it should be labeled with its source and validated in your own internal tests.

    In addition, different evaluations emphasize different capabilities. Some focus on terminal operations, some on code repair, and some on knowledge work or security-related tasks. When selecting, first clarify your own business scenario, then choose the evaluation closest to it.

    6. An Implementation Path for Engineering Teams

    For most teams, building an internal evaluation is more valuable than chasing public leaderboards. You can proceed in the following steps.

    1. Collect historical tickets. Filter reproducible problems from the past six months of bug tickets and code review records to form an initial task set.
    2. Fix the environment. Build a snapshot for each task, recording dependency versions, the system image, and configuration parameters.
    3. Write acceptance scripts. Turn “fix succeeded” into concrete checks, for example whether a certain interface returns the correct status code, whether a certain log line appears, or whether a certain test passes.
    4. Define metrics. Core metrics include pass rate, average number of steps, number of policy violations, and cost per task. Review the task set once a quarter and remove problems that may already be covered by training data.
    5. Sample manually. Automated judgment cannot cover all risks. For each batch of results, sample a proportion of successful traces to check for “passing by luck,” for example modifying the test cases instead of fixing the code.

    When deploying in the cloud, you can split evaluation tasks into independent execution units. Snapshots and traces are stored in object storage, run logs are handed to a logging service, and anomalies are reported promptly through monitoring alerts. These are all general infrastructure capabilities that lower the setup cost, but the evaluation design itself still needs to be handled by the team.

    7. Open Issues That Still Need Attention

    The capabilities of terminal agents are still changing rapidly. Problems that current evaluations struggle to cover include permission boundaries in multi-person collaboration scenarios, dependency changes across multiple code repositories, and the quality of proactive clarification when facing unclear requirements. Teams should treat evaluation as an ongoing effort.