How to Evaluate LLM Agents: A Testing Methodology and Cost-Performance Framework

    This article presents a reproducible methodology for testing large language model (LLM) agents and evaluating their cost-performance. It explains why community impressions after a model launch are not enough for engineering decisions, how to declare test conditions explicitly, and how to separate a model's internal knowledge from retrieval. It covers layered questions for locating errors, efficiency metrics such as first-token latency and rework rate, and an effective-cost formula that accounts for retries and host-side resource consumption. Readers will get a practical framework for building a repeatable model selection loop.

    1. Background: Why “Launch and Top the Leaderboard” Is Not Enough for Model Selection

    Whenever a new generation of large models is released, the first signals in the community are usually scattered impressions: some users feel the answers are smoother, others feel the responses are slower. Such feedback has value, but it is not enough to support engineering decisions. Engineering decisions require reproducible test conditions, verifiable output records, and a consistent way to convert usage into cost.

    A typical hands-on test consists of six questions covering self-identification, knowledge cutoff boundaries, recall of recent events, historical fact checking, and causal attribution. It runs in an agentic coding host with tool-calling capabilities, with network access disabled throughout, a 30-minute limit per question, and a total runtime of about 43 minutes for all six questions. This setup looks simple, but it breaks “model capability” into three observable variables: knowledge coverage, instruction following, and time efficiency. The rest of this article uses this setup as a basis to rebuild a more rigorous evaluation and cost-performance analysis framework.

    2. Declare the Test Conditions Explicitly: Make Results Reproducible

    The credibility of an evaluation conclusion depends first on whether the conditions are transparent. It is recommended to declare six elements at the beginning of the report: model identifier, host form (agent framework or pure chat interface), execution time and time zone, network access, per-question timeout, and total runtime.

    1. Model under test: <model identifier>
    2. Host form: agent runtime with tool calling and file read/write
    3. Execution window: a certain day 05:56 – 06:45 (+08:00)
    4. Network policy: network disabled throughout; no external references in questions are accessed
    5. Per-question limit: 30 min
    6. Total measured runtime: ~43 min (6 questions)

    Disabling the network isolates “retrieval capability” from “knowledge in the parameters.” Once network access is allowed, the evaluation becomes a mixed test of the retrieval pipeline, crawl quality, and reranking strategy, making it hard to separate the model’s own contribution. The time limit exposes the tail latency caused by long reasoning chains, which is especially important for interactive coding scenarios.

    3. Identity and Knowledge Boundaries: Distinguish “Introspection” from “Environment Injection”

    The first question is usually “What model are you, what version, and when does your knowledge cutoff fall?” A high-quality answer clearly distinguishes two types of information sources: one comes from system prompt injection in the runtime environment, and the other comes from the model’s own memory in its weights. The former is an authoritative statement; the latter can only serve as a reference.

    More noteworthy is how the model characterizes its own memory decay. A reliable description is that the closer to the knowledge cutoff date, the sparser the memory, and events within a few months after the cutoff are only vaguely recalled. This kind of “knowing what you don’t know” is more valuable for engineering than a pretty but vague date, because it directly determines whether the caller needs to attach external retrieval.

    4. Layered Design for Time-Sensitive Q&A: Turn “Getting It Wrong” into “Locatable”

    Designing three groups of questions around recent events, historical facts, and disputed conclusions can effectively locate error types:

    Layer Question Type What It Tests Typical Failure Mode
    L1 Major events near the cutoff date Upper bound of knowledge coverage Complete blank or time misalignment
    L2 International conflicts and negotiations within the past year Granularity of details Numbers and dates mixed up
    L3 Battle-damage statistics with third-party assessment disagreement Expression of uncertainty Treating one-sided claims as settled fact

    The design of L3 is especially important. When reports from different parties contradict each other and wreckage evidence can only verify part of the claims, the ideal output should give a range, note the disagreement among sources, and explain how the figures were revised afterward. A chain like “first denial, then partial admission of losses, third parties verifying only a few pieces of wreckage, and then another revision of the figures” in the test record is exactly the touchstone for whether a model has evidence-grading capability. Similarly, for questions involving major engineering and industrial accidents, the model should be able to give the causal mechanism (for example, anaerobic degradation of algae in a water source producing thioether compounds that cause odor) and the handling process (switching the water source, flushing the pipe network, compensation and accountability), rather than just a single conclusion.

    5. Efficiency Dimension: Break Runtime into Optimizable Metrics

    A total runtime of 43 minutes for six questions averages about seven minutes, but the real distribution is usually highly uneven: identity questions finish within a minute, while questions requiring multi-step reasoning and cross-checking take up most of the time. It is recommended to record four metrics:

    • First-token latency: affects interactive experience;
    • Per-question wall-clock time: affects batch throughput;
    • Number of tool-call rounds: affects pipeline stability;
    • Rework rate: the proportion passing on the first attempt, which directly determines hidden costs.
    1. # Pseudocode: single-question evaluation record structure
    2. record = {
    3. "id": "Q2",
    4. "layer": "L2",
    5. "wall_time_sec": 412,
    6. "tool_calls": 0,
    7. "network": False,
    8. "verdict": "partial", # correct / partial / wrong
    9. "error_type": "date_shift"
    10. }

    6. Cost-Performance Accounting: Don’t Just Look at Unit Price

    Cost-performance is not a synonym for “low unit price”; it is the cost per unit of effective output. A practical formula is:

    1. Effective cost = (input token price × input volume + output token price × output volume) × number of calls ÷ first-pass rate

    The first-pass rate is derived from the rework rate. If a solution has a lower unit price but needs two rounds of correction, its effective cost may end up higher. In addition to model calls, the resource consumption on the host side should be included in the total account: the standing overhead of the container platform, log retention in object storage, the peak-shaving cost of message queues, retrieval fees of the log service, and the operational investment in the monitoring and alerting system. Putting these in the same table is the only way to answer “is this agent solution actually expensive?”

    7. Conclusion and Implementation Recommendations

    The core lesson from this hands-on test is that the evaluation of model capability must be conditioned, and the calculation of cost-performance must be denominator-based. For implementation, three steps are recommended: first, standardize the test-condition declaration template, so that any evaluation report starts by stating the host, network, time limit, and total runtime; second, build a layered question bank that scores identity boundaries, time-sensitive coverage, and disputed uncertainty separately; third, use effective cost instead of unit price for decisions, and include the rework rate as a core metric.

    If an enterprise wants to reproduce a similar evaluation in its own environment, it can build an isolated sandbox on a container platform, archive complete conversations and tool-call traces in object storage, and build a dashboard through the log service and monitoring and alerting, thus forming a sustainable model selection loop on cloud infrastructure such as Baidu AI Cloud.