How to Choose and Benchmark LLM Agents for Real-World Scenarios

    Selecting the right model for an AI agent is harder than picking one for single-turn chat or code completion, because the model becomes the execution engine for planning, tool calls, state management, and self-checking. This guide explains common selection pitfalls, how to run a controlled "swap only the model" benchmark across five workflow-based stages, what to observe and how agents typically fail at each stage, and how to turn token burn into a predictable budget. It also covers four-dimension scoring and practical recommendations for choosing primary and fallback models.

    1. Why Model Selection Is Harder for Agents

    In agent applications, the model is no longer just a component that answers questions. It is the execution engine responsible for planning, tool invocation, state maintenance, and self-verification. This leads to a frequently underestimated conclusion: models that perform similarly on single-turn Q&A or code completion can diverge sharply once placed in multi-step tasks.

    There are three common selection mistakes. The first is relying only on leaderboard rankings while ignoring that benchmark tasks may not match the distribution of real business workflows. The second is comparing only per-token price while ignoring the context volume consumed per task and the number of retries. The third is conflating “capability” with “stability,” which leads to frequent workflow interruptions after launch.

    A more reasonable approach is to treat evaluation as a controlled experiment: fix the agent framework, memory strategy, skill set, system prompt, and callable tools, replace only the underlying model, and enable the highest reasoning tier the model supports. Conclusions are transferable only when there is a single variable.

    2. Experiment Design: Trustworthy Results from a “Model-Only Swap” Comparison

    The core of a controlled comparison is environment consistency. Version and record the following elements: framework version, memory read/write strategy, skill list and descriptions, tool signatures and permission boundaries, system prompt, and timeout and retry policies. If any of these drift, the comparison loses its meaning.

    The task set should avoid mechanical numbering and instead be organized into stages that follow real workflows. This article uses a five-stage structure covering the full gradient from “capturing experience” to “high-cost automation”:

    1. Skill packaging: turn a long prompt specification into a distributable, installable, self-checkable capability package.
    2. Page development: produce a well-structured, runnable front-end page from a natural-language requirement.
    3. Documentation and presentation: generate slides and marketing copy, testing structured expression and style consistency.
    4. Knowledge base governance: chunk, index, retrieve, and cite local documents, testing long-context handling and instruction following.
    5. Browser automation: multi-step operations, form filling, and result verification, testing planning and fault tolerance at the highest cost.

    Scoring should use four weighted dimensions: task completion, process compliance (whether the agent asks before acting within permissions and avoids overreach), resource consumption (context and number of calls), and reproducibility (variance across repeated runs with the same input).

    3. What to Observe and How Agents Fail at Each Stage

    Skill Packaging

    The model must convert a prompt specification into a capability package that works right after installation, rather than copying the original text. Observation points include whether the directory structure is well organized, whether metadata and trigger descriptions are clear, whether inputs and outputs are declared, and whether a self-check section is included.

    A typical failure is a trigger description written too broadly, causing the skill to fire in unrelated scenarios, or a missing fallback path on failure, making problems impossible to locate after installation. An acceptable artifact skeleton looks like this:

    1. skill/
    2. manifest.yaml # name, version, trigger conditions, dependency declarations
    3. instructions.md # execution steps and constraints
    4. examples/ # one positive and one negative example
    5. selftest.md # known risks and troubleshooting checklist

    Page Development

    This stage tests whether the model can turn a vague requirement into an accessible structure: semantic tags, distinct states, error messages, and empty-data handling. Observation points are the information hierarchy above the fold, completeness of interaction feedback, and whether unnecessary dependencies are introduced.

    Documentation and Presentation

    The focus is structure rather than wording: whether the conclusion comes first, whether information density per slide is controlled, and whether the copy uses consistent person and terminology. The common failure mode is “correct but not presentable”—text that is too dense, with no narrative rhythm.

    Knowledge Base Governance

    Pay attention to chunking granularity and citation traceability. A sound implementation attaches a source snippet to every conclusion and explicitly replies “no reliable basis found in the knowledge base” when retrieval fails, instead of fabricating an answer. Example logic:

    1. def answer(query, k=5):
    2. hits = retriever.search(query, top_k=k)
    3. if not hits or max(h.score for h in hits) < THRESHOLD:
    4. return "No reliable basis found in the knowledge base"
    5. return generator.compose(query, hits, require_citation=True)

    Browser Automation

    This is the most expensive stage and the one most likely to expose weaknesses. Observation points include whether the agent proactively requests confirmation for high-risk actions such as submission, payment, and deletion; whether it can relocate elements after the page structure changes; and whether failures leave replayable logs and screenshots. If the model lacks a confirmation mechanism at this stage, treat it as a blocking issue.

    4. Cost Control: Turning Token Burn into a Budgetable Item

    Cost should be measured not by unit price alone but by total cost per task, which can be approximated as:

    1. cost per task ≈ (input context + output length) × unit price × (1 + retry rate)

    This yields four general optimization strategies: compress the system prompt and historical memory, keeping only necessary fragments; for retrieval tasks, recall first and then hand off to the model instead of stuffing the entire knowledge base into the context; set budget caps and circuit breakers for high-cost steps; and delegate deterministic logic to code, leaving the model responsible only for judgment and generation.

    5. Conclusions and Implementation Recommendations

    There is no single best choice in model selection, only scenario fit. Start with a small-scale controlled evaluation using three to five “stages” close to your business, recording completion, compliance, consumption, and variance, then decide on a combination of primary and fallback models. On the engineering side, make permission confirmation, citation traceability, and log replay default capabilities rather than relying on the model’s own discipline. If you need elastic compute and unified operations, you can build evaluation and canary environments on general-purpose capabilities such as the container platform, object storage, log service, and monitoring and alerting offered by Baidu AI Cloud, making a model swap a rollbackable configuration change.