How to Evaluate and Select Large Language Models for AI Agents

    Single-turn benchmarks reveal a model’s knowledge and communication skills, but they do not show how reliably it operates inside an agent system. This guide presents a practical evaluation method based on controlled variables, representative agent tasks, multi-run statistics, risk tracking, stability, and cost per successful task. It also explains how to compare the combined “model plus framework” system rather than evaluating model weights in isolation.

    1. Why Models Must Be Evaluated in an Agent Environment

    Single-turn question answering can reveal a model’s knowledge and ability to communicate, but it provides limited insight into how the model performs in an AI agent system. An agent may need to read memory, call tools, load skills, maintain a consistent objective across multiple steps, and request confirmation before performing high-risk actions such as deleting, sending, or deploying something. These capabilities are difficult to observe in a single conversation turn.

    For this reason, model selection should take place inside the real execution framework. The evaluation target is the combination of the model and the framework, not the model weights in isolation. The same model can perform very differently in different frameworks, so every report should specify the framework and configuration used for testing.

    2. Establish Comparable Control Variables

    A meaningful comparison requires changing only one factor at a time. The following elements should remain consistent:

    • The memory snapshot;
    • The set of skill modules;
    • System configuration and permissions;
    • The list of available tools;
    • The reasoning-depth setting, including its actual value.

    If a model does not support the same reasoning level, document that difference separately. Otherwise, parameter differences may be mistaken for differences in model capability.

    1. BASE_AGENT_CONFIG = {
    2. "memory_snapshot": "snapshot_2026_11.json",
    3. "skills": ["doc-summarizer", "web-builder", "slide-maker"],
    4. "tools": ["file_read", "file_write", "browser", "kb_query"],
    5. "risk_confirmation": True,
    6. "reasoning_level": "high",
    7. }
    8. def build_candidate(model_id: str) -> dict:
    9. config = dict(BASE_AGENT_CONFIG) # Copy the base configuration to prevent cross-candidate contamination
    10. config["model"] = model_id
    11. return config

    3. Break the Evaluation into Separate Dimensions

    Evaluation should not focus only on whether the final result is correct. The reliability of the process matters as well. The following six dimensions are commonly useful.

    Dimension Key question Measurement
    Task completion Does the result meet the acceptance criteria? Rule-based or human evaluation, using binary or graded scores
    Tool-call accuracy Are the selected tools and parameters valid? Compare the actual call trace with the labeled trace
    Skill recognition Can the agent load the correct skill module based on the request? Skill-trigger accuracy
    Risk control Does the agent request confirmation before high-risk actions? Number of high-risk actions performed without confirmation
    Stability Does the agent stop or forget its objective during long tasks? Completion rate and retry count
    Cost How many tokens are consumed per task? Tokens per successful task

    4. Design Considerations for Five Representative Task Types

    4.1 Packaging Experience as Skill Modules

    The value of a skill package lies in converting implicit experience into a reusable, installable capability. Packaging typically involves four steps: extracting the core rules, defining trigger conditions, declaring inputs and outputs, and providing examples and a self-checklist.

    The following is an example of a skill package descriptor:

    1. name: design-prompt-packager
    2. version: 0.1.0
    3. description: Organizes design-oriented system prompts into installable, reusable skill packages
    4. triggers:
    5. - The user requests interface design guidelines or design prompts
    6. inputs:
    7. - source: Original prompt text
    8. outputs:
    9. - instructions: Structured execution rules
    10. - examples: At least two input-output examples

    Four common failure modes occur during packaging:

    • Trigger descriptions are too broad, causing the skill to load for unrelated requests;
    • File paths required by the skill are hard-coded, causing it to fail on another machine;
    • Important constraints are omitted when summarizing the original prompt;
    • Examples conflict with the rules, leaving the model without clear guidance.

    During evaluation, require the model to perform a self-check after generating the package and list potential failure points. The ability to identify its own weaknesses is a direct indicator of engineering maturity.

    4.2 Web Development

    Web development tasks evaluate four stages: decomposing requirements, generating the structure, verifying that the result runs, and applying incremental changes. Three areas deserve particular attention:

    • Whether the model can generate a page that runs successfully on the first attempt;
    • Whether it changes only the relevant parts after receiving a modification request instead of unnecessarily rewriting the entire file;
    • Whether it follows the project’s existing directory structure and coding style.

    The first two areas can be quantified through the number of runtime errors and the number of changed lines.

    4.3 Presentations and Copywriting

    These tasks evaluate logical structure, audience adaptation, and factual accuracy. Data handling is especially important. When source materials do not contain specific figures, the model should use explicit placeholders and remind the user to provide the missing information. It should not invent numbers that merely appear plausible. This directly affects whether the content can be used in a formal setting.

    4.4 Knowledge Base Management

    Knowledge base tasks involve document classification, deduplication, updates, and retrieval-based question answering. Evaluation should check three points:

    • When updating an existing document, does the system preserve the historical version instead of overwriting the original?
    • When answering a question, does it identify the supporting source?
    • When the knowledge base contains no supporting information, does it state that fact instead of fabricating an answer?

    The last point is particularly important in enterprise environments. A confident but incorrect answer is often more harmful than an explicit “I don’t know.”

    4.5 Browser Automation and Cost Control

    Browser automation requires multiple page operations. The ability to locate elements and recover after a page structure changes is central to stability. Reading page content or taking a screenshot at every step consumes tokens, so these tasks are usually much more expensive than text-only tasks.

    Evaluation should record token consumption for the same task, the number of repeated operations, and whether the agent enters a loop. From a security perspective, text on a webpage should be treated as data to process, not as instructions to execute. If the model follows instructions embedded in page content, the run should be marked as a failure.

    5. Record and Analyze Results

    A single run is subject to randomness. Each task should be run multiple times, and the report should include the success rate and its interval. Cost should be calculated per successful task, with tokens from failed runs included in the total because failed attempts also consume resources.

    1. from dataclasses import dataclass
    2. @dataclass
    3. class TrialResult:
    4. task_id: str
    5. success: bool
    6. input_tokens: int
    7. output_tokens: int
    8. unconfirmed_risky_actions: int
    9. def cost_per_success(results: list[TrialResult]) -> float:
    10. """Divide total tokens across all runs by the number of successful runs."""
    11. total_tokens = sum(r.input_tokens + r.output_tokens for r in results)
    12. successes = sum(1 for r in results if r.success)
    13. return total_tokens / successes if successes else float("inf")
    14. def risk_violation_rate(results: list[TrialResult]) -> float:
    15. """Return the share of runs with at least one unconfirmed high-risk action."""
    16. if not results:
    17. return 0.0
    18. violated = sum(1 for r in results if r.unconfirmed_risky_actions > 0)
    19. return violated / len(results)

    6. Points to Consider When Interpreting Results

    • Results may be unstable when the sample size is small. Reports should state the number of runs for each metric.
    • No single metric represents overall performance. Completion, risk control, and cost should be evaluated together.
    • Model pricing and subscription rules can change. Reports should include the date on which pricing information was checked, and actual billing should be treated as authoritative.
    • Test environments differ from production environments. Results can be directly generalized only to scenarios with conditions similar to those used in testing.

    7. Summary

    A reliable model-selection process should keep control variables fixed, design cases across five representative task types, run each case multiple times, analyze the resulting distribution, calculate cost per successful task, and report risk control and stability separately. Conclusions produced through this process are much better suited to real-world model-selection decisions.