A Comprehensive Guide to AI Agent Evaluation: From Single-Turn to Multi-Turn Loops

    Automated evaluation is critical for developing and validating AI agents. This article explores the transition from single-turn output checks to multi-turn trajectory analysis. It details the core components of an evaluation system, addresses challenges like error propagation and scoring pitfalls, discusses handling rule loopholes, and outlines actionable engineering practices for building a reliable, vendor-neutral evaluation infrastructure.

    1. Why Automated Evaluation is Necessary

    The essence of evaluation is to establish a repeatable testing and measurement mechanism for AI systems: inputting tasks or prompts into the system, collecting its outputs and execution processes, and then using scoring logic to determine if expectations are met. For Large Language Models (LLMs) and agents, evaluation is not only the basis for model selection but also an engineering approach to discover regressions, locate issues, and verify capability boundaries during the development phase.

    This article focuses on automated evaluation. It does not require real user participation and can run continuously during development, testing, and pre-release. Compared to subjective judgments relying on manual experience, automated evaluation offers the advantages of low cost, repeatability, and batch comparison. However, automated evaluation is not as simple as “running a score.” Especially when the evaluation target upgrades from single-turn Q&A to multi-turn agents, the evaluation structure, scoring logic, and engineering infrastructure become significantly more complex.

    A complete evaluation system typically includes five stages: task definition, environment initialization, agent execution, trajectory recording, and scoring with feedback. Task definition clarifies inputs, constraints, and success criteria; environment initialization provides tools, data, and runtime state; agent execution generates actions and outputs; trajectory recording retains intermediate steps; and the scorer provides explainable conclusions based on results and processes. Missing any of these stages can degrade the evaluation into a coarse-grained check that only looks at the final answer.

    2. Single-Turn Evaluation: Simple and Direct, but with Clear Boundaries

    The structure of single-turn evaluation is the most direct: prompt, output, and scoring logic. The developer provides an input, the model returns an output, and the scorer checks whether the output meets expectations. The scoring logic can be rule assertions, keyword matching, structured field validation, or automated testing. Model scoring or manual sampling can also be introduced as supplements.

    Single-turn evaluation is suitable for verifying tasks like factual Q&A, text classification, information extraction, and format constraints. Its advantages include low cost, fast execution, and easy regression, making it suitable for running extensively in early development. For example, for a task requiring “the output must contain three specified fields,” the scorer can directly check if the fields exist, if the types are correct, and if the value ranges are valid. For open-ended generation tasks, multi-dimensional scoring can be applied: scoring relevance, completeness, consistency, readability, and safety separately, and then synthesizing them into a final conclusion.

    However, the boundaries of single-turn evaluation are also obvious. It assumes a one-to-one mapping between input and output, failing to cover multi-step dependencies, tool calls, environment state changes, and intermediate errors. Early LLMs primarily used single-turn, non-agent evaluations, which matched the capability paradigms of the time. As AI capabilities upgrade, tasks now require models to plan steps, call tools, read environment feedback, and continuously self-correct. Single-turn evaluation is gradually becoming insufficient to describe real-world performance, making multi-turn evaluation increasingly prevalent.

    3. Multi-Turn Agent Evaluation: Upgrading from “Checking Output” to “Analyzing Trajectory”

    The core change in multi-turn agent evaluation is that the evaluation target expands from a single output to an execution trajectory. In each turn, the agent observes the environment, performs reasoning, and selects an action. Actions might call tools, modify files, query data, or update environment states. The evaluator must look not only at the final result but also at whether the intermediate process is reasonable, whether tool calls are correct, whether state changes are controllable, and whether errors are promptly detected.

    In simple evaluations, after the agent processes the prompt, the scorer checks if the output meets expectations. In complex multi-turn evaluations, a coding agent needs to acquire tools, receive tasks and a runtime environment, and execute an “agent loop”: tool calls and reasoning alternate, updating the environment state through implemented actions, ultimately validating the target service or feature using automated tests. The “server-side functionality” here can be understood as any general tool service that needs to be built, configured, and verified, such as a callable business API, a data processing service, or a task orchestration endpoint.

    Multi-turn evaluation typically requires layered scoring:

    • Result layer: Does the final product meet the task goal, and are key functionalities available?
    • Process layer: Is the sequence of tool calls reasonable? Are there invalid loops, unauthorized operations, or missing steps?
    • Constraint layer: Are constraints regarding safety, permissions, formats, costs, and latency observed?
    • Quality layer: Is the solution maintainable, explainable, and does it account for real user value?
    • Stability layer: Can it still converge under environment perturbations, input variations, and tool anomalies?

    A simplified pseudo-code for multi-turn evaluation is as follows:

    1. function evaluate_agent(task, agent, scorer):
    2. state = init_environment(task)
    3. trace = []
    4. while not task.is_done(state):
    5. observation = observe(state, trace)
    6. action = agent.step(task.prompt, observation, trace)
    7. state = apply_action(action, state)
    8. trace.append(action)
    9. result = scorer.score(
    10. final_state=state,
    11. trace=trace,
    12. expectations=task.expectations
    13. )
    14. return result

    This pseudo-code emphasizes three key points: First, the agent does not output all at once but acts step-by-step in a loop; second, the environment state is altered by actions, so the evaluation must be replayable; third, the scorer receives both the final state and the complete trajectory to determine whether “the result is correct” and “the process is trustworthy.”

    4. Error Propagation and Scoring Pitfalls

    Agent evaluation is more complex than single-turn evaluation, largely because errors continuously propagate and amplify. An early parameter error in a tool call might pollute the environment state; subsequent steps continue reasoning based on the erroneous state. Even if the final result appears complete, it might be unusable. If the scorer only looks at the final output, misjudgments are likely: the final answer format is correct, but the intermediate process has severe deviations; or the final result fails, but the agent has correctly identified and reported environmental limitations.

    Therefore, multi-turn evaluation requires the introduction of intermediate checkpoints and trajectory assertions. Common practices include recording environment snapshots after critical steps, performing structural validation on tool call parameters, setting pre- and post-conditions for state changes, checking whether failure paths cut losses in time, and setting thresholds for repeated calls and invalid loops. The scorer should also try to locate the “first deviation point” rather than just providing a total score. This allows developers to know whether the issue lies in task understanding, tool selection, parameter construction, state management, or final acceptance.

    Another pitfall is having an overly singular scoring goal. An agent might achieve a high score by bypassing constraints, exploiting rule loopholes, or taking shortcut paths, but such high scores do not equate to real user value. Automated evaluation requires anti-cheating design: combining layered task sets, environment isolation, randomized inputs, adversarial cases, hidden assertions, and manual sampling. For high-risk tasks, strict validation of necessary constraints should be added to avoid “results that appear successful but have unacceptable processes.”

    5. Rule Loopholes and Innovative Solutions: Evaluation Goals vs. User Goals

    A limitation of static evaluation is that rules are predefined by humans, and agents might find unexpected paths within the rule boundaries. A frontier model once found a rule loophole in a flight booking evaluation task: it did not “clear” the task as set by the evaluation but provided a better solution for the user. This phenomenon indicates a potential deviation between evaluation scores and real user goals. If the evaluator only rewards “completing via the preset path,” it might penalize more reasonable alternatives; if it only rewards the final result, it might ignore process risks.

    A more reasonable approach is to split the evaluation goals into “necessary constraints” and “optimization goals.” Necessary constraints cannot be broken, such as safety, permissions, compliance, and data integrity; optimization goals allow multi-path achievement, such as cost, latency, user experience, and solution maintainability. The scorer should support multi-dimensional scoring and counterfactual checks: if the agent chooses a non-preset path, the evaluator must determine whether the path satisfies necessary constraints, brings better user value, or requires manual review. For innovative solutions that break static evaluation limits, they should not simply be marked as failed. Instead, they should be recorded as “pending review samples” and enter manual review and task set iteration.

    This also requires the evaluation system to have dynamic evolution capabilities. Static task sets easily become outdated, and agents might memorize patterns or exploit rule loopholes. Engineering-wise, dynamic task generation, parameter perturbation, adversarial testing, and periodic manual sampling can be introduced to keep the evaluation set continuously updated. Evaluation reports should not just contain a single score but should include failure type distributions, trajectory anomalies, constraint violations, and manual review conclusions, thereby supporting model iteration and product decisions.

    6. Actionable Engineering Practices

    First, establish a layered task set. Divide tasks into basic, composite, and high-difficulty tasks based on capability dimensions, setting pass criteria and regression frequencies separately. Basic tasks ensure stability, composite tasks verify multi-step planning, and high-difficulty tasks expose boundary issues.

    Second, ensure the scorer is explainable. Every score should be traceable to specific assertions, trajectory fragments, or environment states. Avoid outputting only a black-box total score; provide failure reasons, the first deviation point, and reproducible inputs.

    Third, make the environment isolated and replayable. Use an independent environment for each evaluation, recording tool calls, state changes, and key snapshots. Only with replayability can the error propagation path be located, and can sporadic failures be distinguished from stable defects.

    Fourth, value both process and result. For multi-turn agents, there should be both final acceptance tests and process assertions. Final acceptance can be done via automated testing, while process assertions check tool calls, state constraints, and exception handling.

    Fifth, combine anti-cheating with manual review. Sample and review high-score samples, manually evaluate non-preset path samples, and feed rule loophole samples into task set iteration. Automated evaluation handles scale and efficiency, while manual review handles value judgment and boundary confirmation.

    Sixth, keep the evaluation infrastructure vendor-neutral. If running on the cloud, general container platforms, logging services, and monitoring alerts can be used to support evaluation execution and observability. However, the evaluation logic, task definitions, and scorer design should remain portable to avoid binding to a specific platform. General capabilities provided by platforms like Baidu AI Cloud can serve as one of the running bases, but should not be the sole basis for evaluation conclusions.

    7. Conclusion

    AI agent evaluation is shifting from “single-turn output checking” to “multi-turn trajectory acceptance.” Single-turn evaluation is simple and direct, suitable for early validation and format constraints; multi-turn evaluation is closer to real-world tasks but must handle environment states, tool calls, error propagation, and rule loopholes. A reliable evaluation system should simultaneously focus on results and processes, necessary constraints and optimization goals, as well as automated scale and manual review. Only by treating evaluation as a continuously evolving engineering system, rather than a one-time scoring script, can we accurately measure agent performance and drive it toward a usable production environment.