agents
Glossary ↗Reflection Pattern
The reflection pattern has an agent evaluate its own output and revise it before finishing, rather than returning the first draft. After generating a result, the agent (or a separate critic model) checks it against the goal or explicit criteria — 'does this code compile, does this answer cite sources, did I miss a requirement?' — and if it falls short, feeds the critique back in and tries again. This self-critique-and-retry loop, popularized as 'Reflexion,' measurably improves quality on coding, reasoning, and writing tasks because a second pass catches mistakes the first pass makes under pressure. For builders, reflection is a cheap lever: often a single extra 'review your answer against these criteria' step beats reaching for a bigger model. The cost is more tokens and latency per task, so cap the number of reflection rounds and use concrete, checkable criteria — vague 'make it better' prompts tend to spin without converging.
Related terms