This site only uses technical cookies required for it to work: no tracking, no profiling. Cookie Policy

Skip to content
All terms

What is the reflection pattern?

The loop where an agent critiques its own output and refines it before delivery, with memory of past critiques.

The reflection pattern is an agentic mechanism in which a language model generates an initial output, then critiques it itself by spotting errors or weaknesses, and finally produces a refined attempt that takes that critique into account: a generate, critique, refine loop that can repeat several times before the final result is delivered. Unlike a single inference pass, the agent here explicitly evaluates its own work through a dedicated review prompt. The specific contribution of the Reflexion paper (Shinn et al., NeurIPS 2023) is episodic memory: verbal self-critiques from one attempt are not discarded, but stored as text and reused as context in subsequent attempts on the same task, without updating the model's weights. It is an explicit, observable loop, typically orchestrated at the prompt level, distinct both from upfront planning and from a single model's internal reasoning.

Why a single attempt is not enough

A model that answers in a single pass has no way of noticing its own mistakes: if it makes a calculation error, forgets a constraint, or produces code that does not compile, that error reaches the end user intact. The reflection pattern introduces an internal quality check within the agent itself: before delivering, the system explicitly asks "is this output correct? what is missing? what does not add up?" and uses the answer to correct itself. It does not replace human validation or automated tests, but it cuts down the number of obvious errors that reach that stage, because it catches the most glaring slips before the result ever leaves the agent.

An enterprise example

An agent that generates code for an internal function in a business system does not stop at the first output: after writing the function, it re-reads it with a review prompt that checks edge cases, error handling, and consistency with the project's conventions, then rewrites the parts that fail that check. The same pattern applies to an agent producing a financial report: it generates a first draft, critiques itself on the consistency of the figures and the clarity of the writing, then corrects it. If the agent encounters a similar task later, the memory of past critiques (what went wrong and how it was fixed) remains available as context, instead of starting from scratch every time. This should be kept distinct from a model's internal reasoning chain, which happens before answering and inside the model itself, and from task decomposition, which plans the steps to take before a first output is even generated.

Why it matters for decision makers

An agent that self-corrects before delivering reduces the human review load on the most common slips, but it introduces a real cost: each critique-refine cycle burns more tokens and more time, so it needs a hard cap on iterations and monitoring like any other component of the agent harness. Anyone evaluating an agentic system should ask not only whether it produces a good output, but whether and how it evaluates itself before presenting it, and whether past critiques are reused or lost at every new session.

  • Reasoning models · Models that reason step by step before answering, spending more compute at inference time on complex problems.
  • AI Agents (Agentic AI) · AI systems that go beyond answering: they plan, use tools and take actions autonomously inside your processes.
  • Agent harness · The software scaffolding around an LLM that makes it an agent: the execution loop, the tools, the context, the limits.

A term that hits close to home? Let's talk.

CONTACT ME