Evaluation Methods and Implementation Considerations for LLM Selection in Agent Scenarios
This article explores the unique challenges of evaluating large language models (LLMs) for agent-based applications. Unlike single-turn Q&A, agents require continuous multi-step decision-making, tool calling, and state management. We analyze the key differences between agent tasks and standard QA, propose a six-dimensional evaluation framework covering task planning and error recovery, and share best practices for building custom evaluation datasets and interpreting public leaderboards.
1. Background: Agent Tasks Pose New Requirements for Models
Early LLM applications were primarily single-turn Q&A, where evaluation focused on answer accuracy and clarity. Agent-based applications are fundamentally different. They require the model to make continuous, multi-step decisions around a specific goal: understanding the task, decomposing steps, calling external tools, reading returned results, and revising the plan based on those results until the task is completed or deemed impossible. Deviations in any single step propagate to subsequent steps, meaning the quality of a single response cannot represent overall execution performance.
Recently, many developers have publicly shared their experiences using LLMs to drive automated tasks. The feedback highlights two main differences: given the same task description, different models exhibit vastly different execution paths; given the same set of tools, some models can stably complete multi-step operations, while others deviate from the goal by the third or fourth step. This indicates that model selection for agents requires an evaluation specifically designed around the agent execution chain, rather than directly applying conclusions from standard Q&A benchmarks.
2. Differences Between Agent Tasks and Standard Q&A
Understanding these differences can be approached from three levels:
State Dependency. The output of each step in an agent becomes part of the input for the next step. An incorrect parameter or a misread field in an early step will be inherited and amplified by subsequent steps. In a Q&A scenario, an error only affects a single reply; in an agent scenario, an error alters the trajectory of the entire task.
Structured Tool Calling. The model must generate structured parameters that conform to API specifications, including field names, data types, value ranges, and required fields. Any non-compliance will cause the call to fail. This requires the model not only to “understand the content” but also to “respect the format.”
Termination Judgment. The model needs to determine when a task is complete. Ending prematurely leaves operations unfinished, while infinite repeated calls waste resources and may cause side effects like duplicate writes. Termination judgment is the most easily overlooked aspect of agent reliability.
3. Breaking Down Evaluation Dimensions
It is recommended to cover at least the following six dimensions, each with independent scoring criteria.
(1) Task Planning Capability. This refers to the model’s ability to decompose a goal into executable sub-steps while ensuring their sequence respects dependencies. Evaluation can check whether the plan omits critical steps or includes unnecessary redundant operations. Planning quality is usually evident within the first two or three steps, making it a useful early screening metric.
(2) Tool Calling Accuracy. This involves whether parameter formats are valid, field values conform to API specifications, and the correct tool is selected when needed. This dimension can be split into two sub-metrics: tool selection accuracy and parameter validity rate. The former measures “which tool to use,” and the latter measures “how to use it.”
(3) Error Recovery Capability. When a tool returns an exception, empty result, or timeout, can the model identify the issue, retry using a different approach, or request supplementary information from the user when necessary? This capability directly determines the agent’s usability in real-world environments, where exceptions are far more common than in test environments.
(4) Long-Context Consistency. After dozens of interactions, does the model still adhere to early constraints, such as output formats, permission boundaries, user preferences, and forbidden operations? Evaluation should inject new instructions or interference midway through the task to observe whether the model forgets original constraints.
(5) Termination and Boundary Control. This includes stopping promptly upon task completion, and proactively pausing to request confirmation when encountering unauthorized or high-risk operations. Scoring in this dimension should explicitly penalize “misoperations,” as the cost of an unauthorized write is often far higher than a single task failure.
(6) Cost and Latency. This includes the average number of calls per task, token consumption, and end-to-end latency. These metrics directly determine whether a solution can be deployed at scale. A model with a slightly higher success rate but double the number of calls may not be economically viable in high-concurrency scenarios.
4. Building a Custom Evaluation Dataset
The task distribution of public leaderboards may not align with your business, so enterprises should establish an internal evaluation dataset. The following steps are recommended:
- Sample Collection. Extract typical tasks from real business logs, covering high-frequency scenarios, long-tail scenarios, and historically error-prone scenarios. The sample size should be sufficient to support stratified statistics, typically no less than dozens of cases for each major scenario.
- Data Desensitization. Remove personal information, customer names, internal system addresses, and credentials, retaining only the task structure and key constraints. Desensitized samples can be used for evaluation and safely shared across teams.
- Annotating Success Criteria. Define quantifiable success conditions for each task, such as the final state matching expectations, the number of calls not exceeding a threshold, and no unauthorized operations performed. Success criteria should be defined before the task starts to avoid adjusting standards based on outcomes after the fact.
- Stratified Sampling. Combine simple, medium, and complex tasks according to business proportions. If the test set contains too many simple tasks, conclusions will be overestimated; conversely, they will be underestimated.
- Multiple Runs. Model outputs carry inherent randomness; the same task should be run multiple times to record the mean and variance of the success rate. Conclusions drawn from a single run lack statistical significance.
Below is illustrative code for an evaluation framework. The model invocation part needs to be implemented based on your actual integration method:
from dataclasses import dataclass, field@dataclassclass TaskCase:case_id: strinstruction: strexpected_state: dictmax_steps: int = 10forbidden_tools: list = field(default_factory=list)def run_case(model_fn, tools, case: TaskCase, runs: int = 5) -> dict:"""model_fn is the invocation wrapper for the model to be evaluated, returning a trace containing the final state and each step's action."""outcomes = []for _ in range(runs):trace = model_fn(case.instruction, tools, max_steps=case.max_steps)success = (trace.final_state == case.expected_stateand len(trace.steps) <= case.max_stepsand not any(step.tool in case.forbidden_tools for step in trace.steps))outcomes.append(success)return {"case_id": case.case_id,"success_rate": sum(outcomes) / runs,"runs": runs,}
This example breaks down success determination into three independent conditions: correct result, compliant step count, and no use of forbidden tools. Once a model fails, this breakdown allows for rapid identification of the specific issue category.
5. How to Correctly Interpret Public Leaderboards
Public leaderboards provide reference value, but directly trusting rankings requires verifying the following points:
- Task Distribution. Whether the task types on the leaderboard closely match your scenario. Rankings based on coding tasks cannot be directly extrapolated to customer service, data analysis, or process automation scenarios.
- Version and Timeliness. Model versions iterate rapidly, and conclusions have clear temporal boundaries. A ranking published six months ago has significantly diminished reference value.
- Runtime Configuration. Whether prompt templates, tool descriptions, sampling temperature, and maximum steps are standardized, as these factors significantly impact results. Scores from two groups with different configurations cannot be directly compared.
- Data Contamination. Public questions may have appeared in training data, potentially inflating scores. This type of bias is difficult to detect externally.
- Result Variance. If the variance of a single run’s score is large, the gap between rankings may not be statistically significant. The difference between the first and second place may only be marginal.
