Evaluating LLMs for Agentic Tasks: Methods and Model Selection Practices
This article explains why agentic tasks require dedicated LLM evaluation beyond single-turn Q&A. It outlines six capability dimensions—tool calling, instruction following and decomposition, scheduled and persistent tasks, long-chain execution, multi-role collaboration, and high-throughput processing—and then covers evaluation set construction, annotation rules, data contamination avoidance, and Chinese-language scenario considerations. It also defines core metrics such as task success rate, step-level accuracy, latency percentiles, token consumption, cost conversion, and stability, and provides a five-step evaluation workflow with illustrative code. Readers can use this framework to compare models and select the right LLM for multi-step agent workloads.
1. Why Agentic Scenarios Need Dedicated Evaluation
Traditional LLM evaluation is mostly based on single-turn Q&A, examining capabilities such as knowledge coverage, reading comprehension, and code generation. Agentic scenarios are different. The model needs to understand goals, decompose steps, call external tools, read returned results, retry after failures, and maintain state across multiple turns. High accuracy on single-turn Q&A does not guarantee that a model can complete work reliably in multi-step tasks.
Therefore, model selection should extend the evaluation target from “whether the answer is correct” to “whether the task is completed.” A single task may involve more than a dozen tool calls, and an error at any step can cause the entire task to fail. Evaluation design should focus on task success rate, step correctness, and exception recovery capability.
2. Core Capability Dimensions for Agentic Tasks
It is recommended to split capabilities into six dimensions:
- Tool calling: Whether the model can select the right tool, generate call requests according to parameter specifications, and correctly parse return values.
- Instruction following and decomposition: Whether the model can break complex instructions into ordered subtasks and execute under constraints such as output format, field count, and prohibited actions.
- Scheduled and persistent tasks: Whether the model can maintain context across multiple triggers, determine whether a task has been completed, and avoid duplicate execution.
- Long-chain execution: In workflows with more than ten steps, whether information remains consistent and intermediate results are correctly referenced.
- Multi-role collaboration: Whether multiple execution units can divide work, pass intermediate results, and avoid overwriting each other.
- High-throughput processing: Under concurrent scenarios, whether per-call latency, queueing time, and failure rate remain controllable.
These six dimensions are not independent. Long-chain execution failures often originate from a small error in tool-call parameters that is gradually amplified. During evaluation, both item-level scores and overall results should be recorded so that the source of problems can be located.
3. Building the Evaluation Set
3.1 Data Sources and Stratification
The evaluation set should cover typical tasks in real business scenarios and be stratified by difficulty: single-step tasks, multi-step tasks, and tasks with exception branches. Each layer should retain a certain proportion of questions so that the overall score is not inflated by simple tasks.
3.2 Annotation Specifications
Each sample needs to specify four items: the input instruction, the list of available tools (including structural definitions of parameters), the expected final state, and acceptable equivalent outputs. For open-ended tasks, two annotators should make independent judgments, an agreement coefficient should be calculated, and disputed samples should be sent to a third party for arbitration.
3.3 Avoiding Data Contamination
The evaluation set should be isolated from training data. If questions have already been made public, models may have seen similar samples, and scores will be higher. It is recommended to regularly update part of the question set and retain a portion as an undisclosed blind test set.
3.4 Specific Considerations for Chinese-Language Scenarios
Chinese-language tasks often involve word segmentation ambiguity, omitted subjects, colloquial expressions, and mixed Chinese and English. During evaluation, such real expressions should be included in instructions rather than using only normalized written language.
4. Core Metrics and Calculation Methods
4.1 Accuracy and Task Success Rate
Accuracy equals the number of correctly judged items divided by the total number of items. For agentic tasks, it is recommended to report both task success rate (only all steps correct counts as success) and step-level accuracy. The gap between the two reflects the degree of error accumulation in long chains.
4.2 Response Time
Record time to first token, total latency per call, and end-to-end task latency separately. Averages are easily pulled up by long-tail requests, so P50, P90, and P99 percentiles should also be reported.
4.3 Token Consumption
Input tokens and output tokens need to be distinguished. Tool return values are placed into the context, causing input tokens to expand rapidly as steps increase. Measurement should be per task rather than per call to reflect real cost.
4.4 Cost Conversion
Single-call cost = (number of input tokens × input unit price + number of output tokens × output unit price) ÷ 1,000,000
Cost per 1,000 calls = single-call cost × 1000
The following calculation example is for demonstrating the formula only. Assume the average input is 2,000 tokens, the average output is 900 tokens, the input unit price is CNY 2 per million tokens, and the output unit price is CNY 8 per million tokens. Then the single-call cost is (2000 × 2 + 900 × 8) ÷ 1,000,000 = CNY 0.0112, or approximately CNY 11.2 per 1,000 calls.
4.5 Stability
Fluctuation in results when the same question is run multiple times reflects the determinism of model output. It is recommended to run each question three to five times and calculate the standard deviation of scores and the result consistency rate.
5. Evaluation Workflow and Illustrative Code
The evaluation workflow has five steps: load questions, call the model, execute tools in a sandbox, judge results, and aggregate metrics. Tool execution must take place in an isolated environment to prevent the evaluation process from causing side effects on real systems.
The illustrative code below omits exception handling and is only intended to explain the workflow:
import timeimport statisticsdef run_task(model, task, tools, max_steps=20):history = [task.instruction]tokens_in, tokens_out, steps = 0, 0, 0start = time.time()while steps < max_steps:resp = model.generate(history, tools=tools)tokens_in += resp.usage.inputtokens_out += resp.usage.outputsteps += 1if resp.tool_call is None:breakresult = sandbox_execute(resp.tool_call) # execute in an isolated environmenthistory.append(resp.tool_call)history.append(result)return {"success": task.check(sandbox_state()),"latency": time.time() - start,"tokens_in": tokens_in,"tokens_out": tokens_out,"steps": steps,}def summarize(results):n = len(results)accuracy = sum(r["success"] for r in results) / nlatencies = sorted(r["latency"] for r in results)p90 = latencies[int(n * 0.9) - 1]avg
