Reflexion
Reflexion pattern for self-improving AI agents: verbal reinforcement learning where agents turn failures into written lessons and retry — no gradients required.
Last updated
After this section you can
- Implement the evaluate, reflect and retry loop with a capped lesson memory
- Choose an evaluator for a task and explain why a weak one makes retries harmful
- Price a retry budget per task and tell Reflexion apart from self-refine
Reflexion: Agents That Learn from Mistakes
The agent fails, a real check says why, it writes itself a lesson and retries with that lesson in its prompt. Learning in plain text within a task, with no fine-tuning, and only as good as the check that drives it.
Reflexion turns a failure signal into a written lesson and carries it into the next attempt. The lesson is only as good as the signal: with a trustworthy evaluator such as tests, retries rescue real failures; with a weak one, the agent confidently fixes the wrong thing.