Article · AI agent reliability

Why AI agents fail: four root causes to debug

Classify the first incorrect state, then use the trace to choose the smallest useful fix.

Intermediate10 minute readRoot cause analysis

AI agent failures often look identical from the outside: a wrong answer, an incomplete task, or a timeout. The repair path depends on where the failure began. This guide uses one request—a user asking for the Acme Corp account owner—to show how the same symptom can come from four different causes.

Rule of thumb: locate the earliest incorrect state before changing the final prompt.

Start with the symptom, not the category

Record the request, expected result, actual result, and first visible symptom. Then open the trace and find the first step that differs from a healthy run. In the Acme example, the expected result is an account owner from the CRM; the failed result is an aborted answer after an irrelevant weather response.

  1. State what the agent should have done.
  2. Identify what it actually did.
  3. Find the first step where those paths diverge.
  4. Classify that step before choosing a fix.

1. Prompt or model failure

Example: the agent receives the CRM request and relevant account context, but its model output says the account owner is “unknown” or invents a name without calling the CRM tool.

Diagnose it: inspect the model input, output, model version, prompt version, and context that was actually supplied. If the plan is already wrong before any tool call, the failure is upstream of tool execution.

Resolve it: fix the instruction or context, change one model or prompt variable, rerun the same input, and confirm that the plan now identifies the required evidence.

2. Tool failure

Example: the planner says “CRM lookup,” but the next step calls weather_api, or the CRM tool receives arguments for the wrong schema.

Diagnose it: in TraceProbe, compare the plan node with the selected tool, then open Step Details to inspect arguments, status, and returned data. A successful HTTP response can still be a failed agent step if the result is irrelevant to the task.

Resolve it: validate the selected tool against the plan before execution, validate arguments against the tool schema, and reject irrelevant results before generation. The wrong-tool walkthrough shows this diagnosis in detail.

3. Retrieval failure

Example: the agent chooses the CRM tool correctly, but retrieval returns no Acme account or returns a stale document. The model then gives a plausible answer from incomplete evidence.

Diagnose it: inspect the retrieval query, filters, result count, scores, returned documents, and the exact context passed into the model. If the expected source is absent before generation, changing the final prompt will not restore it.

Resolve it: fix indexing, filters, chunking, ranking, or freshness rules. Rerun the same request and verify that the expected account record appears in the trace before the model answers.

4. Orchestration failure

Example: the agent selects the CRM tool and receives the right owner, but a retry overwrites the state, a branch runs out of order, or a timeout discards the healthy result before the final answer.

Diagnose it: use the Phase Timeline to inspect ordering, retries, durations, and branch transitions. The model response may look normal, so the timeline is the evidence that exposes the orchestration problem.

Resolve it: preserve state between steps, bound retries, make completion conditions explicit, and prevent a failed branch from overwriting a successful result. Compare the repaired timeline with the failing one.

Build a failure hypothesis

Use the category only after locating the first divergence. Write a small, testable statement such as: “When the plan requests a CRM lookup, the router must select crm_lookup and reject any result that cannot identify an account owner.” Then change one variable and compare the next trace.

Find the earliest incorrect state.

Use TraceProbe to classify failures and compare the next experiment.

Get TraceProbe