Multi-Step Text Analysis Agents: Capability Evaluation and Selection

    This article explains how to evaluate and select multi-step text analysis agents by examining their execution structure, six capability dimensions, token and latency costs, pricing models, and reproducible test design. It provides practical criteria and code sketches for comparing agents on quality, speed, and cost.

    1. Why Evaluate Agent Capabilities Separately

    When a large language model handles single-turn question answering, most problems only require judging whether the answer is correct. Agents work differently. They need to understand goals across multiple turns, decompose steps, call tools, inspect intermediate results, and correct themselves when errors occur. A single task may involve more than a dozen model calls, and a failure at any stage can propagate to the final result. Therefore, single-turn Q&A scores cannot reflect how an agent performs in real tasks.

    Developers usually encounter three problems when selecting models. First, the same model may perform noticeably differently under different orchestration frameworks. Second, model versions update frequently, and interfaces and billing rules change accordingly, so existing evaluation conclusions quickly become outdated. Third, the cost of long tasks is difficult to estimate in advance, and overruns are often discovered only after running. The following sections provide a reusable evaluation method across three layers: capability, process, and cost.

    2. Structure of a Typical Multi-Faceted Text Analysis Agent

    Consider multi-faceted text analysis as an example. This type of task usually requires topic summarization, sentiment or stance judgment, entity extraction, and viewpoint comparison across a batch of texts, followed by a structured report. A basic version can be divided into the following modules:

    • Task parsing: convert the user request into a clear list of subtasks.
    • Text chunking and retrieval: split long texts and retrieve relevant passages by subtask topic.
    • Analysis execution: call the model for each subtask and require output in a fixed format.
    • Self-check and correction: verify whether conclusions are supported by the source text and make targeted fixes when problems are found.
    • Report generation: aggregate subtask results and annotate evidence sources.

    The following is schematic code for this flow. Model calls are represented by placeholder methods and should be replaced with specific interface implementations in actual integration:

    1. def run_analysis(request, documents, llm):
    2. plan = llm.plan(request) # Task decomposition
    3. results = {}
    4. for step in plan.steps:
    5. context = select_context(documents, step.topic)
    6. results[step.id] = llm.analyze(step.instruction, context)
    7. issues = llm.self_check(plan, results) # Self-check
    8. if issues:
    9. results = llm.repair(results, issues) # Targeted local repair
    10. return llm.report(results)

    The key point of this code is that each stage has independent inputs and outputs. This makes it possible to measure quality and consumption separately for each stage during evaluation, rather than looking only at the final result.

    3. Six Dimensions of Capability Evaluation

    3.1 Instruction Understanding

    Instruction understanding refers to whether the model can accurately convert natural language requirements into executable goals. During testing, prepare multiple expressions of the same requirement, including vague descriptions, descriptions with explicit constraints, and descriptions containing negative conditions. A qualified model should identify implicit constraints. For example, “only look at data from the past year” should be converted into a time filter condition rather than ignored or misunderstood.

    The judgment method is to construct ten to twenty requirements with constraints, manually annotate the expected subtasks and output format, and then calculate the agreement rate between model outputs and annotations. When the agreement rate is below expectation, it is usually necessary to check how constraints are expressed in the prompt rather than immediately switching models.

    3.2 Task Planning

    Planning capability focuses on step order, dependencies, and resource allocation. A reasonable plan should first acquire and clean data, then perform analysis, and finally aggregate results, with each step having verifiable output. Common defects include missing key steps, incorrect order, and repeated calls for the same subtask, which directly increase cost.

    Planning results can be mechanically checked using dependencies: confirm that the input of each step has been produced by preceding steps and that there are no circular dependencies. This type of check does not rely on model judgment and can be automated.

    3.3 Self-Check and Error Correction

    Self-check means that the model actively verifies whether its output meets requirements after generation. Effective self-check usually relies on explicit checklists, such as “does every conclusion have source evidence,” “do the numbers match the statistics table,” and “are all input documents covered.” Vague requests to “check it” often have limited effect.

    Error correction requires the model to make targeted local edits for specific problems rather than rewriting the whole output. Full rewrites easily introduce new errors and increase output length.

    During evaluation, known errors can be manually injected into intermediate results to observe whether the model can detect and correct them. Detection rate and post-correction accuracy are two independent metrics and should be recorded separately.

    3.4 Generalization and Transfer

    Generalization capability refers to whether the model can transfer an analysis method it has already mastered to a new scenario. For example, if a model performs well when analyzing product reviews, can it apply the same analysis framework to customer support tickets and adjust fields reasonably?

    Testing should use texts outside the training data and structurally different from the original samples. If test samples are highly similar to examples, the conclusions drawn are often overly optimistic.

    3.5 Reasoning Length and Response Latency

    Some models output long reasoning processes before giving an answer. For complex tasks, this reasoning can help reduce errors; for simple tasks, it can cause obvious waste of time and cost. For example, if a task can be completed in only a few steps but the model outputs thousands of words of reasoning, user waiting time increases substantially.

    During evaluation, record first-token latency, total elapsed time, and output length separately, and compare them grouped by task difficulty. This helps determine whether reasoning intensity matches task requirements.

    3.6 Token Consumption

    Token consumption directly determines cost. For the same task under different frameworks or models, input and output token counts may differ by several times. Counting only the final cost cannot show where waste occurs. Recording token usage for each subtask can identify whether planning, retrieval, analysis, or self-check consumes the most, enabling targeted optimization.

    4. Pricing Model Comparison

    Common billing methods fall into two categories: pay-as-you-go and monthly subscription packages.

    The single-task cost of pay-as-you-go can be estimated with the following formula:

    Single-task cost = input tokens × input unit price + output tokens × output unit price

    The effective single-task cost of a monthly subscription can be calculated as follows:

    Effective cost per task = subscription fee ÷ number of tasks completed within the package quota

    The break-even point between the two methods depends on task frequency and task size. Low-frequency, short tasks are suitable for pay-as-you-go. High-frequency, long tasks are often more cost-effective under monthly plans.

    Note that many monthly plans impose time-window limits on quotas, such as resetting hourly or weekly. Estimation should be based on actual usage patterns rather than only the monthly total. Specific quotas and rules should be based on the latest terms published by the service provider.

    5. Building a Reproducible Test Set

    Whether evaluation results are credible depends on whether tests are reproducible. The following practices are recommended:

    1. Fix test samples and, where possible, disable or fix sampling randomness.
    2. Write automated check functions for each case and avoid relying only on subjective manual scoring.
    3. Record model version, call parameters, latency, and token usage.
    4. Run each case at least three times and record the fluctuation range of the success rate.

    Schematic code:

    1. import time
    2. def evaluate(agent, cases):
    3. records = []
    4. for case in cases:
    5. start = time.time()
    6. output, usage = agent.run(case["input"])
    7. records.append({
    8. "case_id": case["id"],
    9. "passed": case["check"](output),
    10. "latency_s": round(time.time() - start, 2),
    11. "input_tokens": usage["input"],
    12. "output_tokens": usage["output"],
    13. })
    14. pass_rate = sum(r["passed"] for r in records) / len(records)
    15. return pass_rate, records

    After the run, summarize pass rate, average latency, and average token consumption by task category. These three metrics should be reviewed together. Looking only at pass rate may ignore the problem of an overly expensive model; looking only at cost may lead to selecting an option that does not meet performance requirements.

    6. Selection and Deployment Recommendations

    • Define acceptance criteria before comparing models. Without clear criteria, it is impossible to determine what “strong capability” specifically means.
    • Track success rate, latency, and cost together. Looking at any single metric easily leads to a one-sided conclusion.
    • Set a budget cap for reasoning. Simple subtasks can use lower reasoning intensity to reduce invalid output.
    • Keep an adaptation layer between business processes and models. When model versions change frequently, only the adaptation layer needs to be replaced, and business processes are largely unaffected.
    • Re-test regularly with the same test set. Model behavior changes with versions, and past conclusions may not apply to the current version.

    There is usually no absolute optimum among capability, speed, and cost. During selection, make tradeoffs based on business priorities for accuracy, response time, and budget, and support judgments with test data.