What is agent reflection?
Agent reflection is a technique in which an AI agent assesses its own output, plan or previous attempt, states errors and gaps in natural language and uses that feedback to improve its next attempt.
Unlike retraining, no weights change: reflection keeps lessons as text, such as a memory note. Reflection grounded in external feedback, such as a failing test or tool error, is usually more reliable than reflection relying only on the model's own judgement.
- Topic
- Agents and protocols
- Also known as
- Self-reflection
- Origin
- Shinn et al., 2023
How agent reflection works
- The agent attempts the task once and produces an output.
- The output is assessed by a feedback source such as tests, a verifier or the model's own critique.
- The agent writes a short reflection note on what went wrong and what to change.
- The note joins the next attempt's context; the loop runs until success or an attempt limit.
In more detail
In-episode and cross-episode reflection
Reflection strategies fall into two main categories: in-episode reflection (keeping critiques inside the current context window) and cross-episode or cross-session reflection (persisting distilled lessons into an episodic buffer for future tasks). Without strict deduplication and decay policies, cross-episode reflection buffers can accumulate stale or contradictory heuristics.
Separating evaluator and optimiser and using a separate critic model
In agentic workflows, the reflection generator and critic can share the same model (self-critique) or be decoupled into a stronger evaluator model or deterministic verifier (evaluator-optimiser pattern). Decoupling avoids shared blind spots and lets teams pair a fast generator with a stricter or domain-specialised reviewer.
How it relates to the built-in self-checking of reasoning models
Since 2025, reasoning-native models trained via reinforcement learning on verifiable rewards perform implicit self-checking and backtracking inside their internal thinking tokens. Explicit external reflection loops remain essential when feedback comes from live compilers, databases or policy checks that occur outside the model's context.
Thrashing, regressions and rolling back to the best candidate
Reflection loops can suffer from thrashing, oscillating between two broken fixes or sycophantic self-critique that introduces new regressions. Production systems pair hard iteration caps with stagnation detection (stopping when error signatures repeat) and rollback to the best-scoring candidate rather than unconditionally keeping the last iteration.
Commonly confused terms
| Term | How it differs |
|---|---|
| Chain of thought | Chain-of-Thought (CoT) generates intermediate reasoning steps before producing a single answer within a single generation call; agent reflection evaluates an already produced output or failed attempt and generates a natural-language critique to guide a subsequent retry. |
| Intrinsic self-correction versus grounded reflection | Intrinsic self-correction asks a model to critique and revise its own answer using only its internal knowledge without external signals; grounded reflection incorporates verifiable external feedback such as unit tests, compilers, linters or tool error messages. |
Why agent reflection matters for on-premises AI
The paper proposing verbal reinforcement learning reports agents reflecting verbally on task feedback and keeping it in a memory buffer improved markedly without weight updates, reaching 91% pass@1 on a coding benchmark. Another paper on iterative self-feedback reports about 20% absolute average improvement across seven tasks over one-step generation. Yet a study of intrinsic self-correction in reasoning finds models struggle to fix answers without external feedback and sometimes get worse, so reflection should pair with verifiable signals.
A fintech firm's coding agent reads failing unit test output, sums up the cause in a short note and retries the fix with it, handing the change to a developer once the attempt limit is reached.
Common questions
Does agent reflection always improve results?
No. Without external feedback a model's self-correction is limited and can make results worse. External signals such as tests, verifiers or tool errors are more reliable.
Does reflection raise cost?
Yes. Each reflection and retry means more model calls; set an attempt limit.
Related terms
Sources
- Shinn et al., Reflexion: Language Agents with Verbal Reinforcement Learning, 2023
- Madaan et al., Self-Refine: Iterative Refinement with Self-Feedback, 2023
- Huang et al., Large Language Models Cannot Self-Correct Reasoning Yet, 2023
In the glossary: Glossary, A to C