C3 · Reflection
Family: Single agent
The agent critiques its own output, or draws a lesson from a failure, then tries again.
Principle
The agent rereads its output, critiques it and rewrites it (Self-Refine). In the Reflexion variant, after a failure signalled by the environment, it writes a lesson it keeps in memory before trying again. The pattern is only worth it when a reliable failure signal exists.
The problem it solves
A first attempt can often be improved, but without feedback you do not know what to fix.
When to use it
- A reliable failure signal exists: tests, compilation, schema validation.
- You want a quick win that is easy to implement before considering a heavier architecture.
When to avoid it
- No external signal is available: self-critique can reinforce a mistake. Prefer a separate, equipped evaluator (B5).
- A plain retry would give a similar result for less: compare against sampling and voting first (B4).
Common pitfalls
The anti-patterns that misuse this pattern, best established first. Each sheet describes the symptoms, the public incidents and the remedies.
Context and memory
- AP28 · Raw or erased error history — Every failed attempt stays word for word in the history and invites more, or it disappears along with its lesson.
Verification and evaluation
- AP56 · Shipping without a verification oracle — The references look real and the tests have “passed”: nobody checked either.
- AP49 · Self-evaluation — The same agent produces and grades: it almost always finds its own work good.
- AP50 · Agent-writable oracle — The agent can see or rewrite what grades it, and ends up optimising the grade rather than the task.
- AP48 · Unvalidated LLM judge — An LLM grades the outputs, and nobody has checked that it grades like a human expert.
- AP51 · Green tests as the only completion criterion — The test suite passes, so the job is done: except the review rejects the PR.
Oversight, operations and governance
- AP77 · Silent regressions on change — The model, the prompt or the infrastructure changes, and only users notice the drop in quality.
Synonyms by vendor
- Reflection (A. Ng, A. Gulli (ch. 4))
- Self-Refine (Madaan et al. (NeurIPS 2023))
- Reflexion (Shinn et al. (NeurIPS 2023))
- Self-reflection (CSIRO Data61)
Neighbouring patterns
Sources
- Reflexion: Language Agents with Verbal Reinforcement Learning — N. Shinn et al. (NeurIPS 2023), 2023
- Self-Refine: Iterative Refinement with Self-Feedback — A. Madaan et al. (NeurIPS 2023), 2023
- AI Agents That Matter — S. Kapoor, B. Stroebl, Z. Siegel, N. Nadgir, A. Narayanan (Princeton), 2024
- Agentic Design Patterns, part 2: Reflection — DeepLearning.AI, The Batch (A. Ng), 2024-03-27
Content reviewed on 2026-10-02