From Answering Questions to Delivering Tasks: Agent Engineering for Long-Horizon Evaluation
The article explains how evaluation criteria for large models are moving from static question answering to end-to-end task delivery. It covers the four capability axes tested by task-oriented benchmarks, the cost impact of mid-execution failures, engineering practices for reliable agents, reinforcement learning with verifiable rewards, scenarios where task benchmarks are not suitable, and a minimal framework for building reproducible agent evaluations.
1. The Model Did Not Change. The Ruler Changed.
Over the past two years, the unit of measurement for large-model capability has shifted. Early evaluations focused mainly on static question answering and knowledge recall: questions were closed-ended, answers had a single ground truth, and scoring depended on whether the model answered correctly. These evaluations measured how much world knowledge was compressed into parameters and the quality of a single response.
The new evaluation criterion is different: can the model complete a multi-step task from start to finish and deliver the result itself? The model must read files, call tools, run commands, inspect errors, and revise the implementation until it works. The process cannot fail as a whole simply because one step is missing.
The metrics changed accordingly. Instead of per-question accuracy, evaluations now look at end-to-end task pass rate, average cost per task (tokens and money), end-to-end latency, and recoverability after failure.
This change leads to an easily overlooked conclusion: under the same new ruler, the leaders are often the teams that placed their products under that ruler early. On one public leaderboard, top models achieve pass rates on long-horizon agent tasks in the range of single digits to low-teens percentages, while the cost per task is on the order of tens of dollars. These figures come from public information, and vendor-reported parts should be viewed conservatively.
This range shows two things. First, there is still substantial room for improvement in long-horizon delivery. Second, every engineering optimization is directly converted into visible differences in ranking and cost.
2. What Four Capability Axes Do Task-Based Evaluations Test?
If we break down “deliver a task,” the evaluation tests four relatively independent capability axes. If any one fails, the end-to-end result goes to zero.
- Instruction following and task decomposition: turning a vague request into ordered, verifiable subgoals and maintaining the original constraints during execution, such as not modifying certain files or keeping an interface compatible.
- Tool calling and state management: selecting the correct tool, generating valid parameters, parsing structured responses, and maintaining intermediate state across steps, such as which files have been changed and which tests have passed.
- Execute-observe-correct loop: after seeing an error, identifying the actual cause instead of repeating the previous failed action; being able to judge whether the problem is fixed or not.
- Long-horizon context management: after dozens of steps, still remembering the original constraints and previous attempts, avoiding duplicate work and avoiding forgetting earlier progress.
A typical task flow looks like this:
Read repository structure → locate relevant modules → modify source code → run build→ parse compile/test output → identify root cause → modify again→ rerun → all green → summarize changes and submit
Knowing facts well cannot save any broken link in this chain. Knowing the correct design pattern does not mean the model can extract the real line number and cause from a noisy error log at step 17.
3. Why Mid-Workflow Failures Cost More Than Knowledge Gaps
The distribution of failure modes is telling. In practice, end-to-end failures are usually not caused by “not knowing,” but by engineering failures such as the following:
- Context truncation: hard constraints from earlier in a long task are pushed out of the context window, causing the model to make changes that violate the original assumptions later.
- Protocol mismatch: the tool response structure does not match the expected fields; after parsing fails, the result is treated as “no result” and the workflow continues.
- Retry without memory: after a failure, the model repeats exactly the same action, turning a fixable issue into an infinite loop.
- Uncontrolled side effects: modifying files that should not be changed, or repeatedly triggering costly external calls.
- Missing termination judgment: either ending too early, such as announcing completion before changes are finished, or persisting indefinitely when the task cannot converge.
The key issue is the amplification of cost. Suppose the average cost per step is C_step, the average number of steps per task is S, the retry ratio of failed tasks is p, each retry adds an average of r steps, and t_step is the average time per step. Then the expected cost per task is approximately:
cost_per_task = C_step * (S + p * r)latency_p95 = t_step * (S + p * r) # latency is amplified by retries as well# illustrative parametersC_step, S, p, r = 0.35, 24, 0.35, 30print(cost_per_task) # approximately 11.6 USD per taskprint(latency_p95) # latency rises as step count is amplified
Because retried tasks usually have to replay historical context, r is often not constant; it tends to grow with task length. This is why long-horizon task costs can rise superlinearly, and why engineering optimization, such as reducing retries and compressing context, often pays off more than simply switching models.
4. Three Engineering Fundamentals
To score under a task-based ruler, engineering must deliver at least three things. This is also what it means to turn complex technical principles into engineering practice.
1) Execution-oriented interaction forms. Keep the model inside a real engineering environment: a real code repository, a real terminal, and real tests and builds. Any approach that replaces the real environment with summaries removes the execution feedback loop and leaves the model without a basis for self-correction.
2) Standardization of tools and skills. Tool descriptions should be unified into machine-readable and semantically clear schemas. Permissions and idempotency should be declared explicitly. High-frequency capabilities should be accumulated into reusable skill packages instead of being re-prompted from scratch every time.
{"name": "run_tests","description": "Run the specified test suite in an isolated environment and return structured results","parameters": {"type": "object","properties": {"scope": { "type": "string", "enum": ["unit", "integration", "all"] },"target": { "type": "string", "description": "File or test case identifier; empty means the full suite" }}},"idempotent": true,"timeout_sec": 300}
3) Externalize long-horizon collaboration and session state. The cost and latency bottleneck of long-horizon agents is often caused by repeatedly moving history around: every request resends the entire context, which increases token costs and hurts server-side context caching. A common approach in the industry is to store session state on the server side and send only new messages plus a reference ID pointing to the previous reply in subsequent requests:
# pseudocode: the server maintains the session and message chainthread = client.threads.create()client.messages.create(thread_id = thread.id,role = "user",content = "Fix the three failing test cases in the test report",previous_message_id = None # first turn)# Later turns only send the increment plus the previous reply referenceclient.messages.create(thread_id = thread.id,role = "user",content = "The second case still fails; see the attached error snippet",previous_message_id = last_reply_id # the server uses this to continue context)
The benefits are twofold: smaller request bodies reduce input token costs, and the server can reuse already computed context caches to significantly reduce time-to-first-byte latency. For long-horizon tasks that can involve dozens of turns, these savings usually account for a meaningful share of total cost. In addition, model outputs should be editable artifacts, such as structured presentations, maintainable page projects, or scene files that can be modified later, rather than a screenshot that cannot be edited or a plain-text summary. Whether the artifact can enter design collaboration and review workflows determines whether the delivery loop can be closed.
5. Training Side: A Reinforcement Learning Practice Room with Automatic Grading
The abilities above can be trained only when there are verifiable reward signals. When a task includes a deterministic judge, reinforcement learning becomes a practice room with clear right and wrong answers:
- Sources of the judge: whether unit tests are all green, whether compilation succeeds, whether static checks introduce no new warnings, whether numerical results match reference solutions, and whether contract tests pass.
- Environment requirements: sandbox isolation, snapshot and rollback support so that failed rollouts do not pollute later training, parallel sampling, and replayable failure trajectories.
- Reward design: in addition to the final result, add penalties for step count and cost; otherwise the model will learn to trade massive retries for passing. Also apply negative rewards when hard constraints are violated, such as modifying paths that are not allowed.
What is trained in this kind of environment is precisely debugging, long-chain reasoning, and self-correction—the very points measured by the new evaluation ruler. This explains a frequently misread phenomenon: an earlier start does not necessarily bring an advantage, because once the evaluation ruler shifts to long-horizon delivery, the score depends on the quality of the execution loop and the judge, not on accumulated time spent covering knowledge. The time difference between two starts can be amplified or offset by this ruler.
6. Where This Approach Does Not Apply
This argument needs a caveat; otherwise the conclusion can slide into another form of bias.
- Short factual questions and single-turn generation: model capability still dominates the result, and the marginal benefit of workflow engineering is small. Measuring them with long-horizon evaluation is a mismatch.
- Tasks that depend on external real-time ground truth: the upper limit is determined by data access and tool quality. Even a stronger model cannot compensate for a missing information source.
- Open-ended creativity and aesthetic judgment: lacking objective graders, these are hard to measure with pass rates and still require human review and sampling evaluation.
- High-compliance, high-determinism scenarios: these require rule engines, approvals, and audit fallbacks, with the model serving as only one component.
At the same time, counterarguments should be presented honestly: leading a task-based leaderboard does not mean a decisive overall capability gap. Some argue that the gap on single-point coding tasks is not large, and that results are heavily influenced by assumptions such as whether the prompt is vague or whether retrieval and web access are available. Others argue that different models have different strengths in reasoning ceilings and engineering fit. A more rigorous statement is: the new ruler measures delivery capability, while reasoning ceiling is a separate dimension. The two overlap only partially and should be evaluated separately.
7. Building a Reproducible Agent Evaluation: A Minimal Plan
- Evaluation set: sample 50–200 multi-step tasks from real business usage. Bind each task to an isolated environment snapshot and an automatically executable judging script.
- Metric matrix: end-to-end pass rate, average number of steps, cost per task, P95 latency, average number of rollbacks, human intervention rate, and number of prohibited operations.
- Regression gate: integrate the evaluation set into continuous integration. After a model or prompt change, run a fixed subset. If the pass rate drops beyond a threshold, block release.
- Cost circuit breaker: set a step limit and budget limit for each task. If exceeded, stop the task and persist the failure trajectory for later analysis and training.
- Failure attribution: label failures into five categories: context, protocol, retry, side effect, and termination. After analyzing the distribution, decide where to optimize. Most teams find that the highest return is not switching models, but fixing protocol issues and adding retry memory.
Deployment checklist: Is the real environment available? Are tool responses structured and do they include timeouts? Are failure trajectories remembered instead of replayed? Is session state externalized so caching can be reused? Can artifacts be edited further and enter collaboration workflows? Are the judges deterministic enough to support automatic rewards? The more “no” answers among these six questions, the larger the gap on task-based leaderboards will be.
