Agent Model Selection: Multi-Dimensional Evaluation and Deployment Cost Estimation
This article explains how to select foundation models for AI agent workloads. It covers why leaderboard scores alone are insufficient, four typical task categories for agent evaluation, how to control evaluation variables for comparable results, how to estimate cloud API costs and local deployment memory requirements, and a step-by-step process for building an internal evaluation pipeline. The goal is to balance capability, stability, and cost based on real business tasks rather than benchmark rankings.
1. Why Model Selection Should Not Rely on Leaderboards Alone
Model capability is not a single number. A model that performs well on question-answering tasks may lag significantly on multi-file code modification. Leaderboards typically provide only an aggregate score, which tells you nothing about where a model is strong and where it is weak.
Agent scenarios amplify this problem. An agent must read context, plan steps, call tools, observe results, and correct its course—capabilities that are tightly coupled. Therefore, selection should start by identifying the capability mix your business requires, and then testing candidate models against corresponding tasks.
2. Four Typical Task Categories and What They Measure
Common agent evaluations in the industry roughly fall into four categories, each corresponding to a real workload.
2.1 Understanding and Modifying an Existing Code Repository
These tasks require the model to read a real repository, locate the root cause of an issue, modify code across files, and run tests to verify the result. Key evaluation points include:
- Understanding of project structure and dependency relationships;
- Accurate retrieval of relevant code within a long context;
- Scope control of modifications, avoiding unrelated changes;
- The ability to iterate on fixes based on test output.
Internal defect fixing and technical debt cleanup typically fall into this category.
2.2 Generating a Complete Project from a Natural-Language Requirement
These tasks provide a requirement description and ask the model to produce a runnable project from scratch. Key evaluation points include directory structure design, module decomposition, interface consistency across files, and project completeness (whether configuration files, dependency declarations, and basic documentation are included).
Scaffold generation and prototype building belong to this category. Scoring should focus on whether the project runs directly, not merely on the number of code snippets produced.
2.3 Multi-Step Tool Calling and Error Recovery
These tasks require the model to select the correct tools from an available set, invoke them sequentially, and adjust its strategy when a step fails. Common failure modes include:
- Incorrect parameter types or formats that are not corrected after an error message;
- Wrong tool selection, such as using search instead of a database query;
- Falling into a loop of repeated calls without stopping in time.
Workflow automation and operations ticket processing depend heavily on this capability.
2.4 Cross-Domain Professional Tasks and Computer Operation
These tasks cover data analysis, report writing, spreadsheet processing, and GUI operation, requiring long-horizon planning and delivery reliability. During evaluation, check whether intermediate artifacts are traceable, whether final deliverables meet the agreed format, and whether silent failures occur anywhere in the task chain.
3. Controlling Evaluation Variables for Comparable Results
Scores from different evaluations often cannot be compared directly because the variables differ significantly. In an internal evaluation, at least the following elements should be fixed:
| Variable | What to Standardize |
|---|---|
| Agent framework | The same orchestration logic, tool definitions, and prompt templates |
| Context length | The same input truncation strategy and window limit |
| Reasoning effort | The same thinking budget or equivalent parameters |
| Number of runs | Repeat each task multiple times and report mean and variance |
| Anti-cheating rules | No access to answers; restricted network access scope |
If these cannot be unified, the differences should be clearly noted in the report, and results should be treated as reference rather than conclusions.
Additionally, simply averaging all scores has limitations. Business value differs across task types, so weights should differ accordingly. For example, the failure cost of a code-fixing task is far higher than that of a document-generation task, and the weighting should reflect that difference.
4. Cost Evaluation: Cloud Billing vs. Local Deployment
Model selection must consider total cost of ownership, not just capability.
Cloud API Costs
Cloud providers bill by input and output tokens, with different pricing tiers. Agent tasks consume far more tokens than ordinary conversations because each step carries the conversation history and tool outputs. Estimation should use real task logs: count the average tokens per task, then multiply by the unit price:
def estimate_task_cost(input_tokens: int, output_tokens: int,price_in_per_m: float, price_out_per_m: float) -> float:"""Estimate the cost of a single task; prices are per million tokens."""return (input_tokens / 1_000_000) * price_in_per_m \+ (output_tokens / 1_000_000) * price_out_per_m# Example: assume 200k input tokens and 20k output tokens per task,# priced at 1.0 and 4.0 yuan per million tokens (values for demonstration only)cost = estimate_task_cost(200_000, 20_000, 1.0, 4.0)print(f"Estimated cost per task: {cost:.3f} yuan")
Memory Estimation for Local Deployment
The main costs of local deployment are GPU memory and storage. Weight memory can be estimated with the following rough formula:
def estimate_weight_memory_gb(params_billion: float, bits: int,overhead: float = 1.1) -> float:"""Estimate the GPU memory occupied by model weights (GB).params_billion: number of parameters in billions; bits: quantization bit width;overhead: extra coefficient for metadata and buffers."""return params_billion * bits / 8 * overhead# Example: 100B parameters with 4-bit quantization, weights are about 55 GBprint(f"{estimate_weight_memory_gb(100, 4):.1f} GB")
At runtime, you also need to reserve space for the KV cache. The longer the context and the higher the concurrency, the larger the KV cache footprint. Therefore, deployment planning should account for weights, KV cache, and concurrency together, with some headroom reserved. Quantization bit width affects accuracy, so the quantized model must be validated on your target workloads rather than judged by size alone.
5. Steps to Build an Internal Evaluation Pipeline
- Inventory business tasks: List the three to five most common task types and annotate the failure cost of each.
- Build the evaluation set: Extract real samples from historical tickets, code repositories, and logs, with sensitive data removed.
- Fix the runtime environment: Unify the framework, tools, and parameters, and record all configurations.
- Run multiple times and report distributions: Repeat each task and report pass rate, average cost, and latency distributions.
- Record failure modes: Categorize issues such as tool misuse, loops, and silent failures—these are often more informative than average scores.
- Validate with limited traffic: Run the model in a canary release on real business traffic, observe user-side metrics, and only then switch over fully.
EVAL_PLAN = {"repo_fix": {"runs": 5, "metric": "pass_rate", "weight": 0.35},"project_gen": {"runs": 5, "metric": "runnable", "weight": 0.20},"tool_chain": {"runs": 10, "metric": "task_success", "weight": 0.30},"office_agent": {"runs": 5, "metric": "deliverable_ok", "weight": 0.15},}assert abs(sum(t["weight"] for t in EVAL_PLAN.values()) - 1.0) < 1e-9
6. Conclusion
Agent model selection should start from business tasks, not from leaderboards. First decompose tasks into measurable capability dimensions, then standardize evaluation variables, record failure modes, and finally account for costs based on cloud bills or local memory planning. Only by considering capability, stability, and cost together can you reach a conclusion suited to your scenario. Models iterate quickly, and this pipeline is reusable: each time a new model is released, you can rerun the same task set and obtain comparable results.
