Reflection, or self-critique, is when an AI agent reviews its own output or plan, spots mistakes or weaknesses, and then revises itself before acting.
Agentic systems can make more than one kind of error: they may miss a constraint, choose a bad tool, hallucinate a fact, or produce a plan that looks plausible but won’t work. Reflection adds a built-in “check yourself” step, which is useful when you want better reliability than a single pass from the model.
In practice, teams reach for reflection when:
At a high level, the agent does a first pass, then evaluates that pass, then optionally rewrites it.
A common pattern is:
This can happen as a simple prompt loop (“review your answer and fix any errors”) or as a more structured agent design where different steps have different roles, such as writer, critic, and verifier. Some systems use the same model for both roles; others use a separate evaluator to reduce self-confirming mistakes.
Reflection is not magic. It works best when the critique has something concrete to check against: a spec, test output, retrieved evidence, a schema, or explicit constraints. If the critique is only “be better,” it tends to be vague.
Task: “Write a SQL query to count active users last week.”
First pass
SELECT COUNT(*) FROM users WHERE status = 'active';
Self-critique
Revised answer
SELECT COUNT(*)
FROM users
WHERE status = 'active'
AND last_login >= CURRENT_DATE - INTERVAL '7 days';
In practice, most teams start with a simple draft-and-check pattern, then add stronger verification only where the cost of mistakes justifies it.