Choosing the Main Model for the Agentic Era: Balancing Capability and Cost

    This article explores how to select a primary model for AI agent scenarios by balancing capability and cost. It breaks down evaluation dimensions, cost calculation methods, selection processes, and engineering practices to reduce token consumption, providing a comprehensive guide for optimizing agent workflows.

    I. Why the Primary Model is a Core Issue in Agent Scenarios

    Agents turn a single Q&A into multi-turn loops: planning tasks, calling tools, reading results, revising plans, and entering the next round. A single task may involve a dozen or more model calls, each requiring context re-input and output generation. Therefore, a single call price does not directly reflect business costs; the true cost is determined by “number of calls × token consumption per call × unit price.”

    In this scenario, the selection logic changes. Flagship models excel at complex problems, but for a large volume of routine tasks, teams need a primary model with sufficient capability, high reasoning efficiency, and controllable unit costs. The primary model handles most daily tasks, while flagship models are only called at critical nodes.

    II. Breaking Down Evaluation Dimensions

    Before selecting a model, break down business tasks into measurable dimensions to avoid looking solely at overall rankings.

    2.1 Code and Engineering Task Capability

    Core metrics for coding tasks include pass rates after fixes or generation, accuracy of change localization, and consistency across multi-file modifications. Evaluations should use issues from real repositories and rely on unit or integration tests as criteria, rather than just checking if the code “looks correct.”

    2.2 Data Analysis and Experimentation Capability

    In machine learning experiments, data cleaning, and metric analysis, the focus is whether the model can correctly understand experiment configurations, identify abnormal results, and provide reproducible steps. You can design samples with incorrect configurations to observe if the model detects the issue.

    2.3 Multi-step Operations and Tool Calling

    Agents often need to execute continuous operations, such as opening pages, filling forms, and verifying results. Key metrics here include completion rate, average steps, and recovery ability after failure. Fewer steps usually mean lower call costs, provided the task is actually completed.

    2.4 Comprehensive Reasoning and Knowledge Work

    Tasks like document summarization, requirement analysis, and solution comparison rely heavily on long-context understanding and structured expression. You should check whether the model omits key constraints and whether conclusions are evidence-based.

    2.5 Token Efficiency

    Token efficiency is a crucial metric for primary models. Output tokens typically cost more than input tokens, and intermediate reasoning steps, redundant explanations, and unnecessary tool calls all increase output volume. Reducing output redundancy can directly compress costs.

    III. Cost Calculation Method

    The formula for calculating the cost per task is as follows:

    1. Cost per call = (Input tokens × Input unit price + Output tokens × Output unit price) / 1,000,000
    2. Cost per task = Cost per call × Number of calls
    3. Cost per successful task = Total cost per task / Number of successful tasks

    Assume an input price of 2 units per million tokens and an output price of 10 units per million tokens (example values, not actual quotes). An agent task contains 15 calls, each with 50,000 input tokens and 8,000 output tokens:

    1. Cost per call = (50,000 × 2 + 8,000 × 10) / 1,000,000 = 0.18 units
    2. Cost per task = 0.18 × 15 = 2.70 units

    If you reduce output tokens by 17% by constraining the output format, then:

    1. Cost per call = (50,000 × 2 + 6,640 × 10) / 1,000,000 = 0.1664 units
    2. Cost per task = 0.1664 × 15 = 2.50 units, saving about 7.6%

    This example shows that input tokens often dominate in long-context agents. Therefore, reducing output redundancy and compressing context must happen simultaneously.

    IV. Selection Process

    1. Define task profiles: List core task types, success criteria, and latency requirements.
    2. Build an evaluation set: Extract 20 to 100 tasks from real business operations, covering common and edge cases.
    3. Record key metrics: Include success rate, input/output tokens, time consumed, and number of calls.
    4. Calculate cost per successful task: Compare different models on the same evaluation set.
    5. Gradual rollout with fallback: Validate on a small traffic scale first, then gradually expand.

    A schematic evaluation process is as follows, where the interface is generic and not tied to any specific SDK:

    1. function evaluate(model, tasks):
    2. results = []
    3. for task in tasks:
    4. output = model.run(task.prompt, tools = task.tools)
    5. results.append({
    6. success: task.check(output.answer),
    7. input_tokens: output.usage.input_tokens,
    8. output_tokens: output.usage.output_tokens,
    9. steps: output.steps
    10. })
    11. return results

    V. Engineering Practices to Reduce Token Consumption

    • Context pruning: Only pass file fragments or document paragraphs relevant to the current step, avoiding full repository inputs.
    • Structured output: Limit return fields to reduce free-form explanatory text.
    • Intermediate result caching: Cache repeated tool query results to avoid redundant reasoning.
    • Limit tool return length: Summarize or truncate overly long tool outputs.
    • Set step limits and stop conditions: Prevent agents from looping infinitely on failure paths.
    • Tiered routing: Assign simple tasks to lightweight models and multi-step complex tasks to the primary model.

    The tiered routing concept can be written in pseudocode as follows:

    1. function route(task):
    2. if task.complexity == "low":
    3. return LIGHT_MODEL
    4. return MAIN_MODEL

    VI. Risks and Boundaries

    • Public benchmarks do not equal business performance: General benchmarks reflect the average level of a certain capability, while business data distributions may differ entirely. Validate with your own evaluation set.
    • Shorter output does not mean unchanged quality: After compressing output, still conduct manual spot checks on key conclusions.
    • High-risk scenarios require specialized evaluation: For fields involving security, finance, or healthcare, establish independent evaluation and compliance review processes.
    • Prices and availability change: Model unit prices, quotas, and available regions should be verified against the official documentation of the service provider and reviewed regularly.

    VII. Implementation Checklist

    • Have you built an evaluation set based on real tasks?
    • Are you recording both success rates and token consumption?
    • Have you calculated the cost per successful task instead of just comparing unit prices?
    • Have you set step limits, caching, and context pruning?
    • Have you retained a fallback path to other models or manual processing?