← All How-to guides

Pillar guide · AI agent root cause analysis

Root cause analysis for AI agents: architecture and workflow

A failed run is a symptom, not an explanation. This guide walks through a disciplined way to move from a red score to the smallest evidence-backed cause, even when the system contains multiple agents, tools, and handoffs.

A chain of execution events leading to a highlighted root cause
A visual map of the decisions and evidence discussed in this guide.

This tutorial uses plain language first and introduces technical terms only when they help. Read it with a small example from your own AI work in mind—a support agent, planner, researcher, or other ai agent.

01

Start with the failure as an observable fact

Write down what actually failed before offering a theory. The agent missed a required field. A tool returned an empty result. A policy constraint was violated. A handoff arrived too late. These statements are observations; ‘the model is bad’ is a theory.

Record the run ID, scenario version, agent system name, model version, score components, status, and time. Without that context, two people can investigate what looks like the same failure but are actually looking at different executions.

02

Reconstruct the execution path

AI agents are systems, not single prompts. A user request may pass through a planner, retriever, tool caller, verifier, and final writer. Root cause analysis follows the path far enough to find the first event that made the eventual failure likely.

Look for ordering, retries, missing inputs, stale memory, unexpected tool arguments, and information boundaries. A late failure is often caused earlier: the final agent cannot include a field because the upstream handoff never carried it.

  • Inputs received by each agent
  • Decisions and tool calls made
  • Responses and errors returned
  • Handoff contents and timing
  • Verifier and constraint results

03

Separate cause, contributing factor, and symptom

Suppose the final answer omitted the customer’s appointment time. The omission is the symptom. The final writer’s template may be a contributing factor. The root cause might be that the scheduling tool returned the time in a new field name and the handoff contract did not detect the change.

This distinction matters because changing the final prompt may hide the symptom for one scenario while leaving the broken interface in place. Diagnose at the layer where the evidence points.

04

Use evidence, not confidence

A root-cause report should show the event that supports the conclusion and the alternatives that were ruled out. If the trace shows a malformed tool response before the missing field, say so. If the trace is incomplete, mark the conclusion as uncertain and collect more evidence instead of filling the gap with a confident story.

Investigate is useful for asking grounded questions across runs. RCA Engine adds structured fault chains, reports, and counterfactuals. Monitoring can reveal whether the same pattern is recurring after a deployment.

05

Verify the repair with a regression run

A fix is not complete when the original example passes once. Rerun the failing scenario, then run nearby boundary cases and a small regression set. Check that the repair improves the failed dimension without creating a new constraint violation, latency spike, or completeness gap.

For multi agent systems, rerun contract tests after changing an output shape. For production readiness, keep the original failure and the repaired run linked so a reviewer can see what changed.

06

A worked example: the missing handoff field

A customer-support workflow has a planner, a policy checker, and a response writer. The final answer omits the customer’s requested date. The first instinct is to edit the response writer’s prompt. Instead, follow the field backwards: was it in the original request, did the planner preserve it, did the policy checker return it, and did the final handoff schema require it?

If the field disappears at the planner-to-policy handoff, the response writer is only the last place the symptom appears. The repair belongs at the boundary, where a contract or verifier can prevent the omission from travelling downstream.

07

How to write a useful root-cause report

A beginner-friendly report can be short as long as it is specific. Include the observed failure, the first unexpected event, the supporting trace or verifier evidence, the likely cause, confidence, and the next experiment. Separate what is proven from what is suspected.

For example: ‘Proven: policy checker received no requestedDate field. Likely cause: planner handoff omitted it after scenario version 4. Confidence: high because the trace shows the field in the input and absent in the handoff. Next: rerun with the required field added and execute the contract test.’ That report is actionable.

Where to go next

Keep the loop small: make one change, rerun the evidence, and only then widen the system.