Controlled-Variable Benchmarking for AI Agents: A Multi-Model Comparison

    A method for comparing LLMs in agent workflows by fixing memory, skills, system prompts, tool permissions, and runtime settings, then measuring skill routing, high-risk action confirmation, long-task stability, token cost, latency, and reasoning effort.

    1. Why Agent Scenarios Need Separate Evaluation

    The requirements for a model differ a lot between chat use and agent use. Chat scenarios mainly depend on the quality of single-turn answers. Agent scenarios require the model to work in a multi-turn loop: reading memory, recognizing which skills are available, deciding which tool to call, parsing tool results, and pausing to ask the user for confirmation when needed. An error at any step can push the whole task off course.

    As a result, a model that performs well in a chat interface may not be stable inside an agent framework. When choosing a model, test agent scenarios specifically. Do not rely only on general leaderboards or single demos.

    2. Controlled Variables for Meaningful Comparisons

    The core of a horizontal comparison is changing only one factor at a time. If you change memory content, skill sets, system prompts, and tool permissions at the same time, you cannot attribute differences in results to the model itself.

    Fix the following elements:

    • Memory snapshot: Use the same historical memory file and record its version number.
    • Skill set: Use the same skill directory and identical file contents, loaded in the same way.
    • System prompt: Keep it word-for-word identical and record its hash so you can verify it.
    • Tool permissions: Use the same allowlist, and keep the external service access configuration the same.
    • Runtime parameters: Keep temperature, maximum output length, and timeout consistent.
    • Reasoning level: Record it as an independent variable, separate from model selection.

    The following is a sample configuration. Adjust the field names to match your actual runtime environment.

    1. experiment:
    2. name: agent-model-comparison
    3. fixed:
    4. memory_snapshot: ./snapshots/memory-v1.json
    5. skills_dir: ./skills
    6. system_prompt_sha256: "<fill in the hash of the system prompt>"
    7. tool_allowlist:
    8. - file_read
    9. - file_write
    10. - shell_exec
    11. temperature: 0.2
    12. max_output_tokens: 4096
    13. timeout_seconds: 300
    14. variable:
    15. model_id:
    16. - model_a
    17. - model_b
    18. - model_c
    19. - model_d
    20. reasoning_level:
    21. - low
    22. - high

    3. Evaluation Dimensions and Metrics

    3.1 Skill Recognition and Loading

    The agent must determine whether the current task matches a local skill, and it must read that skill’s instruction file correctly. For testing, prepare two types of tasks. One type requires a specific skill to complete. The other type is unrelated to any skill. Record the following metrics:

    • Skill hit rate: The proportion of cases where the model actually calls a skill when it should.
    • False trigger rate: The proportion of unrelated tasks where the model calls a skill incorrectly.
    • Load success rate: The proportion of cases where the skill instruction file is read and executed correctly.

    False triggers waste context and quota. They can also push the model to execute in the wrong direction, so read them alongside the hit rate.

    3.2 Confirmation for High-Risk Actions

    Deleting files, modifying configurations, sending messages, and running commands with side effects are all high-risk actions. A well-designed agent should state its intent before executing one of these actions and wait for the user to confirm.

    Design several tasks that include high-risk operations. Measure the proportion of cases where the model requests confirmation before acting. Also record any cases where it executes without confirmation. This metric relates directly to data safety, so it should carry the highest weight. A model’s confirmation behavior cannot fully replace external controls. The tool layer still needs a permission allowlist and a confirmation policy.

    3.3 Stability in Long Tasks

    Multi-step tasks may involve dozens of tool-calling rounds. Focus on three questions: whether the model drifts from the original goal, whether it loses context midway, and whether it can correct itself after a tool error.

    Set checkpoints for each task, and record the state each time a subgoal is completed. Comparing how far each model drifts between checkpoints reflects stability better than looking only at the final result.

    3.4 Token Consumption and Cost

    The token consumption for the same task can differ noticeably across models. The main causes include the length of reasoning, the number of tool-call rounds, and repeated reads of the context.

    During evaluation, record input tokens, output tokens, and any reasoning-related statistics the API provides. Then convert these into the cost per task. Looking only at the per-call price can miss the total cost, which grows with the number of rounds.

    3.5 Response Latency and Reasoning Level

    Higher reasoning levels usually improve success on complex tasks, but they also increase latency and consumption. Measure time to first token, total duration, and success rate together. Observe the relationship between cost and success rate instead of relying on any single metric.

    For simple file organization tasks, the benefit of high reasoning may be small. For multi-step planning tasks, the benefit may be substantial. Confirm these conclusions with actual data.

    3.6 Access Methods and Quota Management

    Billing for model services usually falls into two categories: pay-per-call APIs, and subscription plans that provide a fixed quota.

    • Pay-as-you-go: Cost scales linearly with usage. This suits automated batch tasks and makes budgets easier to estimate and control.
    • Subscription quota: This suits long interactive sessions. Service may be limited once the quota runs out, so the risk of interruption should be part of the decision.

    When choosing, estimate based on task frequency, consumption per task, and acceptable interruption risk. Specific quota rules and rate-limiting policies follow each provider’s published documentation. Record the version of the rules in effect on the day of testing.

    4. Sample Evaluation Script

    The following illustrative code shows how to organize cases, run the agent, and record results. Replace the model call section with your actual client wrapper.

    1. import csv
    2. from dataclasses import dataclass, asdict
    3. from typing import Optional
    4. @dataclass
    5. class EvalCase:
    6. case_id: str
    7. prompt: str
    8. expected_skill: Optional[str] # Skill expected to be invoked. None means no skill should be called.
    9. is_high_risk: bool # Whether the case involves a high-risk action
    10. @dataclass
    11. class EvalResult:
    12. model_id: str
    13. reasoning_level: str
    14. case_id: str
    15. skill_hit: bool
    16. skill_false_trigger: bool
    17. confirmed_before_risk: Optional[bool]
    18. input_tokens: int
    19. output_tokens: int
    20. latency_seconds: float
    21. task_success: bool
    22. def run_single_case(client, model_id, reasoning_level, case, agent_config):
    23. """Run a single case and return the raw trace. `client` is the actual model client wrapper."""
    24. return client.run_agent(
    25. model=model_id,
    26. reasoning=reasoning_level,
    27. prompt=case.prompt,
    28. config=agent_config,
    29. )
    30. def score_trace(trace: dict, case: EvalCase) -> EvalResult:
    31. called_skills = trace.get("skills_called", [])
    32. hit = case.expected_skill in called_skills if case.expected_skill else False
    33. false_trigger = bool(called_skills) and case.expected_skill