Core Concepts

Reflection / Self-Correction

Reflection (or self-correction) is when an agent evaluates its own output or action against the goal and revises it, instead of treating its first attempt as final.

ActEvaluateRevise
An agent acts, evaluates the result against the goal, and revises before continuing.

A model's first attempt at something — a piece of code, a plan, a written answer — isn't always its best one. Reflection is the practice of having the agent (or a separate pass of the same agent) look back at what it just produced or did, judge whether it actually satisfies the goal or meets some quality bar, and revise it if not, before moving on or presenting the result.

This can be as simple as asking a model to critique its own draft against the original request, or as involved as running the actual output through a real check — like running a test suite against generated code — and feeding the failure back in as something to fix. The second kind, grounded in an actual signal like a test result or error message, tends to be more reliable than asking a model to judge its own work purely by re-reading it, since a model re-reading its own output can miss the same mistakes it made the first time.

Reflection adds cost — an extra evaluation pass, sometimes an extra full generation — so it's usually applied selectively: for outputs where getting it right matters more than getting it fast, or after a signal (like a failed test or an error message) makes it clear something needs fixing, rather than after every single action an agent takes.

How it works

The loop in the diagram — Act, Evaluate, Revise — repeats until the output passes evaluation or a retry limit is hit: the agent takes an action or produces an output, evaluates it against some criteria (which might be another model call, a test suite, or a validation rule), and if it falls short, revises and tries again. This is a specialized addition to the general agent-loop — it's essentially an extra check inserted between acting and moving on to the next step.

Example

A coding agent asked to implement a function might write an initial version, run the existing test suite against it (the evaluate step), see two tests fail, and revise the implementation to handle the cases those tests cover — repeating until the tests pass or it decides it needs to ask for help rather than keep guessing.

How it differs

Reflection is related to but distinct from human-in-the-loop: reflection is the agent evaluating and correcting its own work using some signal (a test, a model critique, an error message), while human-in-the-loop specifically involves a person doing the evaluating — an agent can use both, reflecting on its own work first and still checking in with a human before a high-stakes action.

Common misconceptions

Often assumed: An agent reflecting on its own output will reliably catch its own mistakes.
Actually: A model re-reading its own work can miss the same errors it made originally, especially reasoning errors; reflection tends to work better when it's grounded in an external signal like a test result rather than the model's own re-read alone.
Often assumed: Reflection means the agent will keep retrying indefinitely until it gets something right.
Actually: Most implementations cap the number of revision attempts and fall back to asking for help or reporting failure, rather than looping forever.

FAQ

What does 'reflection' mean for an AI agent?
It's the agent evaluating its own output or action against the goal — sometimes using an external signal like test results — and revising it if it falls short, rather than treating the first attempt as final.
Is self-correction reliable, or does the agent just miss its own mistakes?
It depends on what the correction is grounded in — reflection based only on the model re-reading its own text can miss the same errors, while reflection grounded in a real check like a test suite tends to be more reliable.
How is reflection different from human-in-the-loop?
Reflection is the agent evaluating and correcting its own work; human-in-the-loop specifically means a person does the evaluating — they can be combined.

Last checked: 2026-08-28

Related terms