LLM Selection for AI Agents: Evaluation Dimensions and Practices

    This article explains how to evaluate large language models for AI agent workloads. It covers why agent tasks differ from single-turn chat, the engineering metrics to measure (context cache hit rate, tool-calling stability, reasoning overhead, latency, and multimodal input), an evaluation method, a minimal evaluation loop, and a decision framework for model selection.

    1. Background: What Agent Scenarios Require from Models

    An AI agent usually executes multiple steps in sequence to reach a goal. For example, it may read a configuration, query data, run commands, parse the results, and then decide the next action. Compared with single-turn question answering, this kind of scenario has three notable characteristics. First, the context keeps growing. At each step, the earlier conversation and tool outputs must be sent back to the model, so the number of input tokens accumulates with every step. Second, the tool-calling chain is long. A parameter error or format deviation at any step can break the steps that follow. Third, the interaction pace is strongly affected by waiting time. Response speed directly determines user experience and task throughput.

    For this reason, general leaderboard scores or the quality of a single response are not enough to judge whether a model suits agent work. Model selection should break the evaluation down into measurable engineering metrics.

    2. Breaking Down the Evaluation Dimensions

    2.1 Context Cache Hit Rate

    Most inference services cache input prefixes. When the prefix of a new request matches a previous request, the part that has already been computed can be reused, which lowers both cost and latency. The common metric is:

    Cache hit rate = input tokens served from cache / total input tokens

    In long sessions, this metric has a large effect on cost. Cached and uncached input may be billed differently, so you should track both the cache-read volume and the uncached input volume, calculate the ratio between them, and use that ratio to estimate the actual bill.

    Common ways to raise the hit rate include:

    • Keep the system prompt and tool definitions stable within a session instead of rewriting them every turn;
    • Place changing content, such as the current time or random identifiers, at the end of the message rather than at the prefix;
    • Summarize or trim historical tool outputs so the context does not grow without limit;
    • Reuse the same prefix across a session to reduce branching.

    A high hit rate does not automatically mean the response quality is good. It only shows whether the input is organized in a way that allows reuse.

    2.2 Tool-Calling Stability

    Tool-calling stability refers to whether a model, across a multi-step task, generates the correct tool names and parameter structures, uses accurate values, and consistently keeps the correct context. You can quantify it with the following sub-metrics:

    • Call success rate: the share of tool executions that return without errors;
    • Valid parameter rate: the share of parameters that pass JSON Schema or business validation;
    • Path consistency: whether the model keeps serving the original goal throughout a multi-step task, without unrelated operations;
    • Chain completion rate: the share of tasks that reach a final result without breaking partway through.

    When measuring, classify the failures. Categories include format errors, wrong parameter values, wrong tool selection, lost context, and premature termination. Only after classification can you tell whether the problem lies in the model, the prompt design, or the tool interface itself.

    2.3 Inference Overhead and Output Structure

    Some models produce reasoning content before they give the final answer. The share of reasoning tokens among output tokens reflects how much effort the model spends on thinking. A higher share is not always better. It means higher cost and latency, and it is only worth it if it improves task success rate.

    Put the reasoning share and the task success rate in the same table. Do not look at either number in isolation.

    2.4 Latency Metrics

    Break latency into three parts and observe each one separately:

    • Time to first token (TTFT): the time from sending the request to receiving the first output token. It determines how fast the response feels to the user;
    • Generation speed (tokens per second): the throughput during the streaming output phase;
    • End-to-end time: the total time, including tool execution, network round trips, and model generation.

    In agent tasks, end-to-end time is often dominated by tool execution. If you compare only the generation speed of models, you may overestimate how much a faster model speeds up the overall task.

    2.5 Multimodal Input Capability

    If a task requires reading screenshots, charts, or document images, verify visual understanding separately. Check text recognition, table structure reconstruction, and the accuracy of values read from charts. Also confirm whether the model supports image generation. Support for image input and support for image output are two different capabilities, and one cannot be inferred from the other.

    3. Designing the Evaluation Method

    3.1 Building a Fixed Task Set

    Evaluation samples should come from real business workloads. They should cover simple, medium, and complex tasks, and each sample should come with an expected result or a rule that can be checked automatically. Prepare at least several dozen samples per category. Conclusions drawn from one call or from two or three manual tests are not statistically reliable.

    3.2 Controlling Variables

    • Fix sampling parameters such as temperature, or state the actual values in the report;
    • Use the same system prompt and tool definitions for all candidate models;
    • Run each sample multiple times, and record both the mean and the distribution;
    • Record the model version identifier. For models in testing or pre-release stages, date the evaluation conclusions, because performance may change after a version update.

    3.3 Judging Results

    Make success checks as automatic as possible. Examples include validating that the output JSON parses, that file contents match expectations, or that the tool call sequence matches the reference answer. When open-ended tasks are hard to judge automatically, bring in human review, and use double-blind review by two reviewers to reduce subjective bias.

    4. Evaluation Framework Example

    The pseudocode below shows a minimal evaluation loop. The business side must implement run_agent, check_result, and percentile. Adjust the field names in usage to match your actual API.

    1. from dataclasses import dataclass, field
    2. from statistics import mean
    3. @dataclass
    4. class RunRecord:
    5. success: bool
    6. ttft_ms: float
    7. total_ms: float
    8. cached_tokens: int
    9. input_tokens: int
    10. tool_errors: list = field(default_factory=list)
    11. def evaluate(model_client, tasks, repeats=3):
    12. records = []
    13. for task in tasks:
    14. for _ in range(repeats):
    15. result = run_agent(model_client, task) # Implemented on the business side
    16. records.append(RunRecord(
    17. success=check_result(task, result), # Automatic check
    18. ttft_ms=result.ttft_ms,
    19. total_ms=result.total_ms,
    20. cached_tokens=result.usage.cached_tokens,
    21. input_tokens=result.usage.input_tokens,
    22. tool_errors=result.tool_errors,
    23. ))
    24. return summarize(records)
    25. def summarize(records):
    26. total_input = sum(r.input_tokens for r in records)
    27. total_cached = sum(r.cached_tokens for r in records)
    28. return {
    29. "success_rate": mean(r.success for r in records),
    30. "cache_hit_rate": total_cached / total_input if total_input else 0.0,
    31. "p50_ttft_ms": percentile([r.ttft_ms for r in records], 50),
    32. "avg_total_ms": mean(r.total_ms for r in records),
    33. "tool_error_count": sum(len(r.tool_errors) for r in records),
    34. }

    This framework reports the success rate, cache hit rate, TTFT, average end-to-end time, and tool error count in one output, which makes it easier to compare models side by side.

    5. Selection Decision

    Organize the dimensions into a table so the team can agree on the evaluation criteria:

    Dimension Key metrics Decision implication
    Cost Cache hit rate, input and output unit prices Has the largest impact in long-session scenarios
    Stability Tool-call success rate, chain completion rate Directly determines whether the task can be delivered
    Latency TTFT, end-to-end time Affects interaction experience and task throughput
    Inference overhead Share of reasoning tokens Judge cost-effectiveness together with success rate
    Multimodal Image understanding accuracy Depends on whether the business needs to read images

    Start with a phased rollout to a small share of traffic, and add real production tasks to the evaluation set. Then decide whether to switch fully. Record how each metric changes before and after the switch, and keep a rollback plan.

    6. Common Pitfalls

    • Using a single experience in place of statistical conclusions. Individual task speed and success are strongly affected by network and tool conditions.
    • Treating the feeling of faster generation as an overall productivity gain. If the bottleneck is tool execution, the benefit of a faster model is limited.
    • Ignoring versions and timeliness. Models with the same name may perform differently at different stages, so conclusions should carry the test date.
    • Focusing only on output quality and ignoring cost structure. In long sessions, input-side caching and repeated computation often affect total cost more than the output does.