DEV Community

Cover image for Your AI agent got the answer right? Evaluate the whole trajectory
Ronan Oliveira
Ronan Oliveira

Posted on

Your AI agent got the answer right? Evaluate the whole trajectory

The agent answered, the answer looks good and the test passed. Except that, midway through, the system lookup came back with the wrong data, and nobody saw it. Anyone who evaluates AI agents only by the final answer is checking the last step of a process that has several.

This post summarizes a 2026 academic paper that addresses exactly this point: ToolChain-CRC, by Jeffery Opoku and David Banahene. The proposal is useful for anyone making decisions about agents in production, even without getting into the math: it changes the question from "is the answer right?" to "was the whole run trustworthy?".

Note: This text explains third-party research. ToolChain-CRC is not a Zihin feature. The numbers in the illustrations are there to show the mechanism and do not come from the paper's experiments.

Why evaluating only an AI agent's final answer is not enough

An agent rarely does just one thing. It retrieves documents, calls tools, checks intermediate information and only then writes the answer or performs the action. Each step depends on the previous one.

The authors describe the problem like this: the final response may look acceptable even when retrieval was weak, a tool output was wrong or an earlier step was unsupported. For them, this is not only a practical problem. A score that only sees the final answer cannot certify failures that happened upstream and do not show up in it.

On the left, a four-step chain where the tool fails and the final answer still looks correct. On the right, the same chain treated as one trajectory, with a risk score per step and a single risk for the run. Labels are in Portuguese.

What ToolChain-CRC proposes: evaluate the trajectory

The core idea is to treat each agent run as a full trajectory: the request, the retrieval steps, the tool calls, what each one returned, the intermediate checks and the final answer.

The method has four parts:

  1. A risk score per step. Each step gets a score: did retrieval bring enough evidence? Was the right tool called? Is the answer supported by what was found?
  2. Trajectory risk. The step scores are combined into a single number for the run.
  3. An accept-or-intervene rule. Using past runs that have already been assessed, a threshold is calibrated. Below it, the run goes ahead. Above it, the system abstains, retrieves again, calls a safer tool or escalates to human review.
  4. An alarm during the run. Risk is tracked step by step, and the agent can be stopped before it produces the final answer.

The method is a calibration layer placed on top of an existing agent. It does not choose the model, the retriever or the tools.

How the threshold is calibrated

The statistical part comes from a family of techniques called conformal risk control. Instead of promising that the agent never fails, it offers a more modest and verifiable guarantee: the share of runs that the system accepts and that fail stays below a target chosen by whoever operates the system. The rate is computed over all runs, not only over the accepted ones.

In practice, this requires a set of past runs labeled as "good" or "failed". The threshold is the most permissive point that still keeps that share of accepted failures within the target.

The authors add a caveat that matters to any manager: controlling risk is not enough. Because the rate covers all runs, intervening more also lowers the guaranteed number, and a rule that sends every case to a human is safe and useless. That is why the method picks, among the safe thresholds, the one that causes the fewest interventions.

On the left, past runs spread by risk level and a threshold that separates accept from intervene. On the right, a risk-evidence curve that crosses the alarm limit before the last step, and the agent is stopped. Labels are in Portuguese.

When data and tools change

Agents in production do not live in a stable environment. The document base grows, an API changes behavior, the profile of requests shifts. Last month's calibration may not describe today's agent.

The paper includes an extension for this scenario: the guarantee carries a margin that depends on how far current runs have drifted from the calibration runs, with terms that can be audited. The authors also recommend periodic recalibration.

What the experiments show and the limits of the method

The tests cover simulations, retrieval tasks derived from a public question-answering dataset and a case study with an agent and tools. The authors' conclusion is consistent across them: calibrating only on the final answer lets retrieval and tool failures through when the environment changes, while calibrating on the trajectory keeps the risk of accepting a failed run below the target.

The paper itself lists limits worth knowing before treating the idea as a ready-made solution:

  • It depends on good risk scores. If the step scoring is poor, the method rigorously controls the wrong quantity.
  • Severe shifts are expensive. When the environment changes a lot, keeping risk on target may require many interventions and human reviews.
  • Calibration must represent the future. The runs used for calibration have to resemble the ones that will come.
  • The experiments are benchmark-style. The authors say the tests are not the same as a real deployment, with paid models, changing external tools and human-labeled traffic.

Tip: The lesson that does not depend on the math: a trustworthy agent is not the one that gets the answer right. It is the one you can audit at every step.

What this changes for those who buy or operate agents

You do not need to implement conformal risk control to benefit from the idea. It translates into direct questions for the vendor or the internal team:

  • Is every step recorded? Without the history of retrievals, tool calls and intermediate results, there is no trajectory to evaluate, only the answer.
  • Can a past run be reconstructed? Investigating an error depends on seeing what the agent saw at each step.
  • Is there an intervention point before the action? In sensitive operations, the question is who can stop the agent and when.
  • Is there a limit that stops the run? A ceiling that halts the agent is different from an alert that arrives afterwards.

At Zihin, the complete session is recorded, with phases, tool calls, tokens, costs and latencies, and replay lets you reconstruct any past run; details are on the security page. Sensitive actions can require a person's approval before they are executed, and each agent can have a spending ceiling that stops the run, as we show in human approval and budget per agent. These are operational controls, not the statistical calibration the paper proposes.

Conclusion

Evaluating AI agents only by the final answer means checking the result without looking at the process. ToolChain-CRC organizes an alternative: treat the whole run as the object of evaluation, calibrate a threshold to accept or intervene and track risk while the agent is still working.

For decision makers, the first step is simpler than the statistics: make sure every step is recorded, that an intervention point exists and that someone looks at the trajectory, not just the answer. If you want to assess how this applies to your processes, book a diagnostic.

Sources

  • Jeffery Opoku and David Banahene, ToolChain-CRC: Conformal Risk Control for Agentic AI Under Retrieval and Tool-Use Drift (Jun. 2026) — arXiv:2606.18467. All credit for the method and the results belongs to the authors; this post is a summary and does not replace reading the original.

Originally published in Portuguese on the Zihin blog. I work at Zihin, which connects AI agents to a company's systems and processes, with permissions, human approvals and cost tracking.

Top comments (0)