flowchart TB
subgraph S["Multi-agent system under test"]
T[Task and initial state] --> O[Orchestrator]
O --> A[Specialist agents]
A <--> M[Shared memory and messages]
A --> X[Tools and environment]
X --> F[Final response and state]
end
S -. events, versions, cost .-> TR[Episode trace]
C[Fixed task cases] --> R[Run candidate and simpler baselines]
R --> TR
TR --> D[Deterministic outcome and policy checks]
TR --> H[Qualified human or calibrated judge]
D --> G[Compare task success, safety, reliability, and cost]
H --> G
G --> Q[Release decision and verified regression cases]
Chapter 26. Autonomous and Multi-Agent Systems
Evaluating Autonomous and Long-Horizon Agents
An autonomous research agent is preparing a weekly report, and its first three steps are correct. It keeps working after the evidence budget runs out, however, and sends a draft with an unverified claim. A short benchmark might credit the early progress without ever revealing the later failure, yet over a longer run, errors can compound, the goal can drift, and the cost of reaching an answer becomes part of the evaluation.
The right test depends on what the agent is allowed to do. Autonomy ranges from recommending an action, through supervised reversible actions, to sustained work with limited oversight. As authority becomes broader or more persistent, a team needs direct evidence about milestones, budgets, safe stopping, reversibility, and intervention—not just a score earned under a narrower setup.
We begin with a single long-running agent and the decisions that keep its work bounded, then consider what changes when several agents delegate, communicate, and share evidence. Such a system can inherit all the risks of an individual run while adding coordination failures of its own.
After this chapter you will be able to:
- map an autonomy level to required evidence and safeguards;
- evaluate plans for feasibility, dependencies, and goal preservation;
- score milestone progress and recoveries in long-horizon runs;
- test termination, resource budgets, and requests for human oversight;
- estimate reliability and oversight needs across repeated runs.
Illustrative case. The research agent and tasks are fictional teaching examples, not claims about current capability.
Evaluation contract
| Step | Long-horizon-agent example |
|---|---|
| Case | Complete a multi-step research task with milestones, a fixed evidence budget, and a safe stopping condition. |
| Observable evidence | Milestone state, evidence provenance, action and approval trace, resource use, and terminal reason. |
| Oracle | Required milestone predicates, trusted sources, action-authority rules, and budget limits. |
| Metric | Verified completion, unsafe actions, safe stopping, recovery, cost, latency, and repeated-run reliability. |
| Decision | Advance autonomy only when critical gates and required oversight evidence pass at the intended authority level. |
| Failure analysis | Locate the first divergence in planning, execution, environment change, verification, budget handling, or oversight. |
26.1 Levels of autonomy and evaluation
An agent that recommends a refund and one that can issue it operate under different conditions, even if they propose the same action. To make that distinction testable, name the level under test—recommendation-only, supervised execution, bounded autonomous execution, or persistent autonomy—and specify allowed tools, action scope, duration, approval points, and rollback. A score earned with low authority is not evidence that broader privileges are safe.
Evaluation gates should therefore grow with the impact of delegation. A team can inspect plan quality before execution, test tasks in a sandbox before permitting scoped real actions, and establish sustained monitoring before persistent delegation. Human interventions belong in the record, because success with approval after each action says little about performance without that oversight.
26.2 Evaluating plans
A promising plan is not yet a completed task: it may omit a necessary source, assume an unavailable tool, or spend the budget before reaching verification. Treat it as a proposal and check whether it covers required milestones, respects dependencies and resource limits, surfaces uncertainty, and preserves the user’s goal. If conditions change, the agent may need to replan; in other cases, the right response is to stop or ask.
During execution, compare actions with the original request and approved updates to detect goal drift. Use observable plan steps, tool calls, and state changes rather than grading private reasoning text, and involve qualified reviewers when plan clarity itself matters.
26.3 Long-horizon tasks: progress and checkpoints
The research agent’s early progress is useful only if the team can distinguish a completed milestone from an assertion of completion. Before a run, therefore, define a predicate for each milestone: what evidence marks it complete, which dependencies must already hold, and how much partial progress counts? The resulting scorecard can reveal where work stalls, although it does not replace separate checks for the final goal and safety constraints.
Checkpoints also make recovery testable: record state, pending work, consumed budget, and the source of each assumption, then interrupt runs, make context stale, or fail a tool partway through. When the run resumes, the agent must preserve critical constraints and avoid repeating completed, non-idempotent actions.
26.4 Termination, loops, budgets, and runaway behavior
In the opening example, exhausting the evidence budget should change what the agent is permitted to do next. Explicit caps on steps, tool calls, tokens, cost, and wall time make that boundary testable, provided each cap has a defined safe response. Record whether the run ended through completion, clarification, approval wait, budget exhaustion, error, or a guardrail; because containment can succeed even when the task remains unfinished, report both outcomes.
Repeated action/state patterns, retries without new evidence, and expanding scope may indicate runaway behavior. Context matters, however: a repeated read could be useful verification rather than a loop. Inspect the trace and report cost and latency distributions, including the slowest or most expensive runs, instead of relying on averages alone.
26.5 Human-in-the-loop checkpoints
Stopping at a boundary may mean asking a person rather than abandoning the task. Approval is appropriate when an action exceeds delegated authority, cannot be undone, has material ambiguity, or crosses a defined risk boundary. Too many interruptions impose a cost, while action without required approval creates a different failure, so measure over-asking and under-asking separately. The request itself should give the reviewer enough context to decide.
One useful paired test contrasts a low-risk reversible action that should proceed with a similar high-impact action that should pause. In the latter case, check that the agent waits, retains relevant state, and resumes only after the correct approval signal. A simulator can exercise the behavior, but it cannot stand in for the product’s authorization service.
26.6 Sandboxing, reversibility, and irreversible actions
Before granting authority outside a test environment, the team needs a safe way to observe what the agent would do. Synthetic accounts, disposable workspaces, mocked services, and least-privilege tokens limit the consequences of an experiment. For each state change, define rollback and verify that it restores the required invariants; irreversible actions need explicit approval or should be excluded from automated runs.
Containment is itself a measurement: did the agent stay inside the sandbox, leave unrelated state untouched, and describe its limits accurately? A simulated pass does not demonstrate that production access controls work, so those controls need separate tests.
26.7 Reliability at scale
Even when every individual safeguard looks reasonable, long runs combine many uncertain decisions. To see how those decisions play out, repeat tasks across seeds and representative environment states, then report pass rate by task, variation across runs, catastrophic failures, and cost. The task remains the statistical unit: many seeds for one scenario are correlated evidence, not many independent tasks. Chapter 2 discusses clustered comparisons.
Recovery deserves its own evidence as well. Measure its cost and safety, retrying only operations that are idempotent or otherwise safe to repeat. Recovery quality, duplicate effects, and time to a safe final state all matter, because a later pass does not erase damage from an earlier attempt.
Worked example: pass at least once versus pass every time
For one fixed long-horizon task, ten independent seeded runs produce seven complete successes and three failures. The unit is one run of this task. If a deployment requires two fresh attempts both to succeed, the estimated \(pass^2\) reliability is \(\binom72/\binom{10}2=21/45=0.467\). By contrast, the estimated probability of at least one success in two attempts is \(pass@2=1-\binom32/\binom{10}2=0.933\). These answer different operational questions.
from math import comb
n_runs, successes, k = 10, 7, 2
pass_at_k = 1 - comb(n_runs - successes, k) / comb(n_runs, k)
pass_power_k = comb(successes, k) / comb(n_runs, k)
print(f"pass@{k}: {pass_at_k:.3f}")
print(f"pass^{k}: {pass_power_k:.3f}")
print(f"unit: one task; runs: {n_runs}; successful runs: {successes}")pass@2: 0.933
pass^2: 0.467
unit: one task; runs: 10; successful runs: 7
The \(pass@2\) result may suit a task where either of two attempts is enough, but it does not say both attempts will succeed. These estimates come from one task and ten runs, so they do not describe a task population; shared state or seeds can also break the independence assumption. For a release gate, choose the measure that matches the real retry policy, report uncertainty across tasks, and keep catastrophic side effects as non-compensable failures.
26.8 Scalable oversight
As run volume grows, a person may no longer be able to inspect every action, so oversight can combine deterministic invariants, sampled audits, risk-based review, change summaries, and independent checks of high-impact results. Automation can route work for review, but its decisions need evaluation too: retain the trace it used, measure missed unsafe cases, and periodically audit cases it marked safe.
For work that is difficult to check directly, tests, citations, diffs, provenance, and concise evidence trails can make review more practical. These artifacts may themselves be incomplete or fabricated, however, so check them against authoritative sources and actual system state.
26.9 Dynamic and asynchronous environments
Many harnesses change the world only when the agent acts. Outside the harness, however, deadlines pass, concurrent users make changes, background jobs run, and resources expire even while the agent is waiting. Simulate independent state changes, delayed actions, and stale observations, then examine whether the agent notices, revalidates its preconditions, replans, or stops safely.
Gaia2 is a benchmark example of asynchronous environments, where state can evolve independently of agent actions [1]. A simulation still leaves a gap to production, however, so document its modeled dynamics, compare with production traces where permitted, and test live concurrency and rollback controls on their own.
Multi-Agent Systems
A coordinator assigns one agent to find current return rules, another to draft an answer, and a reviewer to check it. Although the draft is polished, it is wrong because the reviewer relied on the same stale source as the researcher. Three agents agree, yet none has independently established that the source is current.
Adding agents does not remove the need for the boundaries discussed above; instead, it adds handoffs, shared memory, and orchestration to the system being evaluated. Coordination may improve coverage, but it can also multiply cost, spread an error, and obscure where a failure began. To tell which happened, measure the end-to-end result and risk alongside each worker’s contribution.
After this chapter you will be able to:
- distinguish agent-level capability from system-level performance;
- evaluate handoffs, communication, and shared-state integrity;
- test orchestration, delegation, and termination policies;
- measure cost amplification and correlated errors;
- attribute failures without scapegoating a single agent from incomplete evidence.
Illustrative case. The researcher, reviewer, and sources are synthetic. Model-agent agreement does not count as independent confirmation.
Evaluation contract
| Step | Multi-agent example |
|---|---|
| Case | Research and verify a current policy using multiple roles, with a single-agent or fixed-workflow baseline. |
| Observable evidence | Task assignment, messages, source lineage, handoffs, tool actions, decisions, and total resource use. |
| Oracle | Current authoritative policy and adjudicated evidence requirements; agent consensus is not the oracle. |
| Metric | System-level correctness, evidence coverage, correlated errors, cost per success, and harmful side effects. |
| Decision | Keep the multi-agent design only if it meets quality and safety gates and adds value over the simpler baseline. |
| Failure analysis | Trace the earliest contract break and use controlled ablations before assigning cause to a particular agent. |
System boundary and evaluation flow
Evaluate one complete task episode, including orchestration, workers, shared state, tools, and the final state visible to the user. The trace connects those components to the evidence used for scoring, while running the same cases through the multi-agent candidate and simpler baselines makes comparison possible. Score the outcome with authoritative checks and qualified human or model review where judgment is needed.
The trace should preserve task and agent versions, assignments, messages, evidence references, tool arguments and results, state changes, retries, interventions, termination reason, latency, and cost. Keep the final task outcome separate from step-level process findings: a judge can assess qualities such as clarity or evidence use, whereas authoritative state checks determine whether a transaction occurred. Follow Chapter 7 to qualify model judges and the offline and production-monitoring workflows to carry evaluation through release.
26.10 Agent-level vs. system-level metrics
The stale-policy example shows why strong-looking worker scores need not add up to a successful system. An orchestrator can misroute work or lose a result, while a specialist with lower standalone accuracy might still add value by catching errors others miss.
Track worker accuracy, evidence quality, latency, and policy compliance alongside system outcome, cost, reliability, and harm. Specify the boundary—planner, workers, tools, shared memory, critic, and human reviewer—and include failed delegations and retries in cost and latency. When interpreting the measures, remember that system success uses the completed episode as its denominator; per-invocation scores answer a different question.
26.11 Handoff and communication failures
When one agent hands work to another, a clear message can still omit the fact that matters most. For that reason, treat the handoff as a data contract: the recipient needs the relevant task, constraints, evidence, uncertainty, source versions, and authority. Test truncation, stale summaries, conflicting results, duplicate messages, and malformed handoffs, while retaining message lineage and sender/receiver IDs so a missing field can be traced.
Fluency is not proof that a summary is faithful, so compare important facts and constraints with source material, check that observation is distinguished from inference, and verify that open questions survive. Downstream workers also need tests for mistaking untrusted content for policy.
26.12 Orchestration quality
The orchestrator determines which handoffs occur and when, as well as routing work to suitable roles, respecting dependencies and budgets, detecting missing outputs, handling disagreement, and stopping when evidence is sufficient. Measures such as routing accuracy, excess delegation, safe parallelism, timeout handling, and duplicate side effects after retries reveal different parts of that job.
Complexity is worthwhile only if it improves the result enough to justify its costs, so run the same task set through simpler baselines, such as one agent, a fixed workflow, and a workflow with human review. AutoGen illustrates conversational orchestration patterns, but using a framework says nothing by itself about a system’s performance [2].
26.13 Emergent failure modes and cost amplification
The shared stale source illustrates a broader problem: several agents may have the same blind spot, echo an unsupported claim, loop in debate, or reinforce a flawed plan. When they rely on the same source or method, their votes provide weak evidence of independent verification, so track evidence and method diversity rather than only the number of agents that agree.
Coordination also consumes resources. For each successful task, add model calls, tools, retries, and human interventions, while reporting tail latency and the cost of failed runs as well. To test hard budgets, check that agents stop or escalate rather than spawn work without bound, and compare repeated-run system reliability with the single-agent baseline.
26.14 Attribution across agents
Once a system fails, the most visible agent is not necessarily the source of the problem. A trace linking assignments, messages, evidence, tool calls, state changes, and decisions can identify the first observable contract break. Controlled ablations—removing a worker, substituting verified output, or holding the planner fixed—can then help identify contributors, although interacting components mean responsibility may not add up neatly.
Report both what failed first and the confidence in any root-cause claim. “The reviewer received a summary that omitted the effective date” is observable, whereas “the summarizer caused the incident” requires stronger evidence that other explanations were ruled out. Retain the full trace for adjudication.
Chapter summary
Autonomous agents
- Match autonomy and permissions to demonstrated evaluation and approval controls.
- Check milestone evidence, dependencies, goal preservation, and replanning.
- Cap budgets, define safe stops, and report when a cap ends an unfinished run.
- Measure unnecessary approval requests and actions taken without approval.
- Isolate experiments; verify that rollback restores state.
- Report repeated-run reliability, tail cost, catastrophic failures, and recovery.
- Keep evidence inspectable and audit samples independently.
- Test deadlines, concurrent changes, stale observations, and asynchronous state.
For product managers. Define the agent’s authority, duration, and budget. Which actions pause for approval, and what evidence will the approver see? Review tail-risk and safe-stop results alongside task completion.
Multi-agent systems
- Score each worker and the complete system at the task boundary.
- Version handoff contracts and verify that evidence and constraints survive.
- Compare orchestration with simpler baselines; include retry cost.
- Track correlated errors, added cost, loops, and tail latency.
- Use traces and ablations to locate contributors, and state causal uncertainty.
- Seek independent evidence; do not treat similar agents’ agreement as confirmation.
For product managers. What measurable gain calls for multiple agents? Who owns the final action, and who resolves disagreement? Ask for cost per successful task, a simpler-baseline comparison, and evidence that reviewers consult sources independently.
Hands-on labs (Python)
Lab 1: Autonomous agents
Run python code\ch16\lab_autonomy.py. This synthetic run records milestone flags, a step budget, and approval state, then prints the shared evaluation record from Appendix D. No actions are executed.
from bookkit.autonomy_eval import evaluate_run
from bookkit.system_eval import evaluation_record
result = evaluate_run(
milestones={"plan": True, "verify": False, "report": False},
required_milestones={"plan", "verify", "report"},
steps=8,
max_steps=10,
approval_required=True,
approval_received=False,
)
print(result)
print(evaluation_record(
claim="The research run completes required milestones within authority and budget",
case_id="autonomy-research-01@v1",
evidence_ref="fixture://ch16/run-summary",
oracle={"id": "milestone-authority-budget-v1", "result": "fail" if not result["passed"] else "pass"},
metric={"name": "autonomous_run_pass", "value": int(result["passed"]), "denominator": 1},
decision={"result": "hold" if not result["passed"] else "pass", "reason": "required verification milestone and approval are missing" if not result["passed"] else "synthetic fixture gate"},
failure_category="milestone_or_approval_incomplete" if not result["passed"] else None,
)){'milestones_complete': False, 'incomplete_milestones': ['report', 'verify'], 'budget_ok': True, 'approval_ok': False, 'passed': False}
{'claim': 'The research run completes required milestones within authority and budget', 'case_id': 'autonomy-research-01@v1', 'evidence_ref': 'fixture://ch16/run-summary', 'oracle': {'id': 'milestone-authority-budget-v1', 'result': 'fail'}, 'metric': {'name': 'autonomous_run_pass', 'value': 0, 'denominator': 1}, 'decision': {'result': 'hold', 'reason': 'required verification milestone and approval are missing'}, 'failure_category': 'milestone_or_approval_incomplete'}
Lab 2: Multi-agent systems
Run python code\ch17\lab_multiagent.py. With synthetic agent messages, this fixture checks handoff completeness and system cost, then prints the shared evaluation record from Appendix D.
from bookkit.multiagent_eval import evaluate_handoff, cost_per_success
from bookkit.system_eval import evaluation_record
handoff = {"task": "verify_policy", "constraints": ["use_current_version"],
"evidence_ids": ["policy-v3"], "uncertainty": ["effective_date"]}
handoff_result = evaluate_handoff(
handoff,
required_fields={"task", "constraints", "evidence_ids"},
)
unit_cost = cost_per_success(total_cost=12.0, successful_tasks=3)
print(handoff_result)
print(unit_cost)
print(evaluation_record(
claim="Does delegation preserve required evidence and improve task outcomes over a simpler baseline?",
case_id="multiagent-policy-handoff-01@v1",
evidence_ref="fixture://ch17/handoff",
oracle={"id": "handoff-contract-v1", "result": "pass" if handoff_result["complete"] else "fail"},
metric={"name": "handoff_completeness_and_cost", "value": {"complete": handoff_result["complete"], "cost_per_success": unit_cost}, "denominator": 3},
decision={"result": "insufficient_evidence", "reason": "handoff and cost fixtures do not establish an end-to-end benefit over a baseline"},
failure_category=(
"baseline_outcome_comparison_missing"
if handoff_result["complete"]
else "incomplete_handoff"
),
)){'complete': True, 'missing': []}
4.0
{'claim': 'Does delegation preserve required evidence and improve task outcomes over a simpler baseline?', 'case_id': 'multiagent-policy-handoff-01@v1', 'evidence_ref': 'fixture://ch17/handoff', 'oracle': {'id': 'handoff-contract-v1', 'result': 'pass'}, 'metric': {'name': 'handoff_completeness_and_cost', 'value': {'complete': True, 'cost_per_success': 4.0}, 'denominator': 3}, 'decision': {'result': 'insufficient_evidence', 'reason': 'handoff and cost fixtures do not establish an end-to-end benefit over a baseline'}, 'failure_category': 'baseline_outcome_comparison_missing'}
Exercises
Autonomous agents
- Design. Define autonomy levels for an agent that drafts, schedules, and sends customer messages.
- Hands-on. Add an over-budget condition to the lab and define the safe terminal state.
- Oversight. Write two paired cases that distinguish appropriate approval requests from over-asking.
- Reliability. Plan a repeated-run study with both many tasks and repeated seeds per task.
- Discussion. What makes a result inspectable when no human can review every intermediate action?
Multi-agent systems
- Design. Define message fields for a research handoff that preserves evidence and uncertainty.
- Hands-on. Remove
evidence_idsfrom the lab handoff and inspect the failure. - Experiment. Compare one agent, two collaborating agents, and a fixed workflow on the same task set.
- Attribution. Propose an ablation to test whether a critic agent improves final correctness.
- Discussion. Why is agreement among several agents not necessarily independent evidence?
Further reading
Autonomous agents
- Liu et al., AgentBench, for interactive-agent failure modes across tasks [3].
- Yao et al., \(\tau\)-bench, for policy-constrained interaction and repeated-run reliability [4].
- Froger et al., Gaia2, for agent evaluation in dynamic and asynchronous environments [1].
- Lightman et al., Let’s Verify Step by Step, for the potential and limits of process supervision [5].
- Efron, for resampling methods used to quantify uncertainty [6].
Multi-agent systems
- Wu et al., AutoGen, for conversational multi-agent application patterns [2].
- Liu et al., AgentBench, for interactive agent evaluation [3].
- Efron, for resampling-based uncertainty analysis in comparative experiments [6].