LLM Selection and Evaluation for AI Agents: A Practical Guide
This article explains why AI agents change the way teams evaluate large language models, shifting the focus from benchmark scores to engineering constraints such as instruction following, structured output stability, long-context consistency, and resource consumption. It outlines a controlled evaluation setup that changes only the underlying model, four evaluation dimensions, common failure modes with practical fixes, and a selection approach based on contract fit rather than rankings.
1. Why Agents Turn Model Selection into an Engineering Problem
In the past, evaluating a language model mostly meant looking at its performance on standardized Q&A, writing, and coding tasks. In an AI agent scenario, however, the model does more than generate text. It makes decisions inside a continuously running task loop: reading context, deciding whether to call a tool, choosing parameters, parsing return values, retrying or switching paths after failures, and requesting confirmation before risky actions.
This introduces a key change: how “smart” a model is no longer the only variable. Instruction following, structured output stability, long-context consistency, and resource consumption per task all directly determine whether an agent can complete its work.
A typical problem many teams run into after connecting a model to an agent framework is not that the model gives wrong answers, but that framework behavior degrades: local skill descriptions are not recognized correctly, high-risk actions that should trigger a confirmation prompt are executed directly, tool parameter formats drift, and the same task repeatedly consumes large amounts of context. These issues are often misdiagnosed as “the model is not good enough,” when they are closer to a mismatch between the model and the framework contract. So the first step in selection is not to look at benchmark scores, but to define the contract.
2. Control the Variables: Change Only the Model
To draw conclusions from a horizontal evaluation, you must control variables. A reproducible approach is to create multiple identical agent instances and keep the following elements the same:
- Memory: the same history summarization strategy, the same vector retrieval configuration, and the same dataset;
- Skills: the same skill list, the same natural-language descriptions, and the same invocation examples;
- System settings: the same system prompt, the same output format constraints, and the same refusal and confirmation policies;
- Tools: the same tool set, the same parameter schema, and the same permission boundaries.
The only variable is the underlying inference model. Enable the available high-reasoning tier consistently to avoid bias from running one model with deep thinking enabled and another without it.
An illustrative evaluation configuration (pseudocode, expressing the idea only):
agent_config = {"memory": {"summary_window": 8, "retrieval_top_k": 5},"skills": ["file_read", "http_request", "sql_query", "calc"],"system_prompt": SHARED_PROMPT,"tool_schema": SHARED_SCHEMA,"risk_policy": {"confirm_before": ["delete", "deploy", "pay"]},"model": None # The only variable: replace one model at a time}
It is worth emphasizing that different models vary in their sensitivity to prompts and tool descriptions. Therefore, “the same prompt set performs very differently across four models” is itself a valuable finding, not an evaluation mistake.
3. Evaluation Dimensions: Four Layers of Agent Fit
3.1 Task Completion
Use a set of end-to-end tasks, such as “read a local file, extract fields, write to a database, and generate a report.” Track the first-pass success rate, the pass rate after one retry, and whether failures occur during planning or execution. Planning-stage failures usually show up as missing steps; execution-stage failures usually show up as parameter errors or return-value parsing errors.
3.2 Tool and Skill Contract Compliance
Measure tool call accuracy: whether the function name matches, whether required parameters are present, whether enum values are valid, and whether hallucinated parameters appear. Then look at skill recognition rate, meaning whether the model can select the correct skill from the skill descriptions instead of hard-coding a flow based on common sense. The confirmation rate before high-risk actions must be tracked separately, as it is a safety baseline.
3.3 Resource Consumption
In agent scenarios, the real cost is not just the unit price, but the total input and output context consumed to complete the same task, the number of tool round trips, and the number of retries. A model that is “smarter but more verbose” may multiply the cost per task through repeated context reads and multiple ineffective calls. Recommended metrics: average turns per task, average input context length, and the share of ineffective calls.
3.4 Long-Run Stability
Run the same agent continuously for several hours and watch for memory drift, format breakdowns, repeated actions, and silent stops. In long-running tasks, staying stable often matters more than peak capability.
A minimal scorecard can summarize the results (scores are illustrative, not real data):
| Dimension | Weight | Description |
|---|---|---|
| Task completion | 35% | End-to-end first-pass rate |
| Contract compliance | 30% | Tool parameters and confirmation policy |
| Resource consumption | 20% | Context and turns per task |
| Long-run stability | 15% | Continuous-run performance |
4. Common Failure Modes and Engineering Fixes
- Skill not recognized: the skill description is too abstract. Fix it by adding boundary notes on “when to use / when not to use” plus one or two invocation examples.
- High-risk action not confirmed: writing the confirmation requirement into the system prompt is often not enough. Enforce interception at the tool layer, so the framework rather than the model executes the policy.
- Context explosion: set length limits and summarization compression for retrieval results to keep entire logs out of the context.
- Format drift: validate structured output against a schema, and on failure return a clear error message for the model to self-correct instead of silently retrying.
- Quota and rate limits: design checkpoint resume and queued calls for long-running tasks, with logging and monitoring alerts to locate abnormal turns.
5. Selection Conclusion: Fit Over Ranking
The point of a horizontal evaluation is not to crown the “strongest model,” but to find the one that best matches your agent framework contract. If tasks are mainly long-running, prioritize stability and resource consumption; if they are tool-call intensive, prioritize contract compliance and structured output; if the budget is tight, base the decision on total cost per task rather than unit price. Turn the evaluation into a repeatable pipeline, so each model iteration only requires rerunning the same task set. Selection then shifts from “going with a feeling” to “looking at data.”
