Concepts / Agent Failure Modes and Evaluation

Agent Failure Modes and Evaluation

Reflection is what gives an agent a real chance of succeeding; running steps alone does not guarantee that the task is done correctly.

  • Programming

A Trip That Booked Without Crashing

Imagine an agent that has been asked to book a multi-leg trip. It builds a plan, carries out each step, and reports success at the end. Nothing crashed, so from the outside the run looks healthy. Yet the agent may have booked a connection that arrives after the hotel check-in window closes, because nothing in its process ever asked whether the plan made sense.

This is the gap that reflection is meant to close. An agent can keep operating without examining its own work, but it is far less likely to actually accomplish what it was asked to do. The rest of this article explains what reflection is, where it fits in a task, how the parts of a reflective system cooperate to find and fix errors, and what it costs to build in.

Running Steps Versus Reflecting on Them

Running steps and succeeding at a task are not the same thing. An agent that only executes steps moves forward no matter what each result looks like. If a step produces a wrong result, the next step simply builds on it, and the run ends with a report of completion. Reflection adds a pause after the result arrives, asking whether the outcome is actually right before the agent commits to its next direction.

Execute stepExecute stepErroneous resultnothing checks itErroneous resultjudged by evaluatorNext step builds onitCause locatedself-reflectionReported as doneRevised planproducespassed forward uncheckedproducesreflection finds the causecorrection acts
When a step produces a wrong result, what happens next in an agent that only executes steps, and what happens in an agent that also reflects?

Four Points to Pause and Evaluate

Reflection is not a single event that happens at the end of a run. It can be placed at several points along the way, and each placement answers a different question about the work so far. There are four such points in a task: after the request arrives, after the initial plan is made, after each execution step, and after the whole plan has run. The question changes as the agent moves further into the task.

Request arrivescheckpoint 1Initial plancheckpoint 2: does the planmake sense?Execution stepcheckpoint 3: after eachstepWhole plan has runcheckpoint 4: was the taskaccomplished?Task finishedplan is builtplan is carried outall steps completejudged successful
Where in the task does the agent stop to check its work, and what comes before and after each of the four checkpoints?

Read left to right, the diagram shows the agent's path through a task. The first checkpoint sits right after the request arrives, before any work begins. The second follows the initial plan, asking whether that plan makes sense before it is carried out. The third follows each execution step, so a bad result can be caught while it is still one step old rather than after the whole run. The fourth comes after the whole plan has run, judging whether the task as a whole was accomplished. The trip agent in the opening example would have been caught by the second checkpoint, because a connection arriving after check-in closes is a plan that does not make sense.

  • Checkpoint 1: after the request arrives, before planning
  • Checkpoint 2: after the initial plan is made, before execution
  • Checkpoint 3: after each execution step, or after a set number of steps
  • Checkpoint 4: after the whole plan has run, judging the final outcome

Who Does the Judging

Reflection needs a judge, and the judge can be arranged in more than one way. The simplest arrangement uses the same agent. It is prompted with self-critique questions that ask it to look back over its own output. A second arrangement hands the judging to a separate component, such as a specialized scorer, which is a model that assigns a concrete score to each outcome.

Separating the judge from the actor is useful because the agent that produced an answer is often poorly placed to notice that answer's flaws. The same separation can be extended across multiple agents. One agent plans and acts, while another agent evaluates the result after each step or after a set number of steps.

How an Evaluator and Self-Reflection Find an Error

Reflexion, proposed by Shinn and colleagues in 2023, makes the path from a finished step to a corrected direction explicit by splitting reflection into two modules. The first is an evaluator that judges the outcome. The second is a self-reflection module that analyzes what went wrong. After both have run, the agent proposes a new trajectory, which is the authors' term for a plan. Each step therefore passes through evaluation and self-reflection before the agent commits to its next direction.

Executed stepproduces an outcomeEvaluatorjudges the outcomeSelf-reflectionanalyzes what went wrongNew trajectorythe proposed new planNext stepoutcomefailure flaggedcause identifiedcommitted to
When an output is wrong, which component flags the problem, which one diagnoses where it started, and in what order do they pass information?

In the diagram, the evaluator comes first. It receives the outcome of the executed step and judges it. If the judgment is that the task has not been accomplished, that failure is passed to self-reflection, which looks for why the attempt went wrong. The evaluator tells the system that something is wrong; self-reflection tells it where the problem started. Only after both have run does the agent propose a new trajectory, and only then does it move on to the next step.

Tracing a Flawed Plan Into a Revised One

When the evaluator judges that the task has not been accomplished, the actor is prompted to think about why the attempt failed and how the approach could be improved. That improvement becomes the basis for a new plan. The diagram below follows one flawed plan through that process, from its original form to its replacement. Each arrow is labeled with the event that triggers the move to the next state.

Flawed planconnection arrives lateStep executedbooking madeOutcome judgedevaluator: not accomplishedCause identifiedself-reflection: timingconflictRevised planconnection checked againstcheck-inplan is carried outevaluator runsfailure triggers self-reflectionimprovement becomes new plan
What states does the plan move through from the original flawed version to the revised one, and what triggers each transition?
Worked example

Revising the Trip Plan After an Error Is Found

An agent builds a plan to book a flight that lands after the hotel check-in window closes. It carries out the booking, and the evaluator judges that the task has not been accomplished. Trace how the plan is revised.

  1. 1
    Start with the flawed plan

    The plan booked a connection that arrives too late. The plan itself was never checked against the hotel's check-in window.

  2. 2
    Execute the step

    The booking is made. The step ran without error, so nothing crashed, but the outcome is wrong.

  3. 3
    Evaluator judges the outcome

    The evaluator judges that the task, arriving at the hotel in time, has not been accomplished. This judgment flags that something is wrong.

  4. 4
    Self-reflection locates the cause

    Self-reflection looks back at why the attempt failed and finds the timing conflict: the connection and the check-in window were never compared.

  5. 5
    Propose the revised plan

    The improvement becomes the basis for a new plan. The new plan checks each connection's arrival time against the check-in window before any booking is made.

Result

The flawed plan has been replaced by a revised plan. The agent commits to the new plan as its next direction, and the failure became the input for the improvement rather than a silent error carried to the end of the run.

Mistakes Developers Make With Reflection

  • Common mistake

    Treating a run with no crash as a successful run

    What it looks like

    The trip agent reports success because every step completed without an exception.

    Why it fails

    Nothing in a plain run asks whether the plan made sense, so a clean run can still fail to accomplish the task.

    Do this instead

    Add a checkpoint that judges the outcome, not just whether execution finished.

  • Common mistake

    Adding reflection but no correction step

    What it looks like

    The self-reflection module notes that a connection is too late, but the agent continues on the original plan.

    Why it fails

    Reflection produces the insight; error correction is the step that acts on it. Reflection by itself changes nothing.

    Do this instead

    Route the diagnosis into proposing a new trajectory, and only then continue to the next step.

  • Common mistake

    Assuming the agent that wrote an answer will spot its own flaws

    What it looks like

    A single agent is asked only to review its own output and approves a plan it just wrote.

    Why it fails

    The agent that produced an answer is often poorly placed to notice that answer's flaws.

    Do this instead

    Consider a separate judge, such as a specialized scorer or a second evaluating agent.

  • Common mistake

    Placing every checkpoint at the end of the run, which catches a bad step only after all later steps have already built on it

Paying for Reflection

Reflection is relatively easy to add to an agent compared with improving how it generates plans in the first place, and it can produce a surprisingly large gain in performance. The price is paid in latency and cost. Thoughts, observations, and sometimes actions all consume tokens, and that consumption grows with the number of intermediate steps. Users feel the extra delay, and the bill rises accordingly. Reflection also adds context pressure, because the extra thoughts and observations take up room in what the agent is working with.

CheckpointQuestion it answersExtra work it adds to the run
After the request arrivesIs the request understood before planning begins?One evaluation before any work starts
After the initial planDoes the plan make sense before it is carried out?One evaluation of the whole plan before execution
After each execution stepDid this step produce a right result before the next builds on it?One evaluation per step, which grows with the number of steps
After the whole plan has runWas the task accomplished?One final evaluation of the complete outcome

Each checkpoint answers a different question and adds its own share of cost. Placement is a design decision.

Placing Checkpoints on a Task

EASY

An agent is asked to read a long report, write a one-page summary, and email it to a colleague. Its initial plan leaves out the email step entirely. At which of the four pause points would the agent most directly catch this flaw, and why?

Hints
  • Think about which checkpoint comes right after the plan is made but before any step is carried out.
  • The question at that checkpoint is whether the plan makes sense, which is different from whether a single step succeeded.

Key Takeaways

  • Reflection is what gives an agent a real chance of succeeding; running steps alone does not guarantee that the task is done correctly.
  • Reflection can be placed at four points: after the request arrives, after the initial plan, after each execution step, and after the whole plan has run.
  • An evaluator judges the outcome, self-reflection finds the cause, and an error correction step proposes a revised plan. Reflection alone changes nothing.
  • Reflection improves outcomes but adds latency, token cost, and context pressure, so checkpoint placement is a design decision.

More concepts starting with A