Flashcard: how does Reflexion let an agent learn from failed runs?
Reflexion has the agent attempt a task, fail, write a natural-language post-mortem to episodic memory, and prepend that reflection on the next attempt. The agent learns from failure without any weight updates.
Imagine a student who fails a coding test, then sits down and writes a one-paragraph note to their future self: I used the wrong loop, I forgot the base case, next time check the edge cases first. They paste that note on their desk. The next time they take a similar test, they read the note before starting. They are not any smarter in the brain sense, but they are smarter in the context sense because the note tells them what to avoid. Reflexion does exactly that for an AI agent. After a failed attempt, the agent writes a short reflection about what went wrong, stores it, and reads it before the next attempt. No retraining, just self-written notes that make the next try better.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Define Reflexion as an outer loop that attempts, reflects on failure in natural language, stores the reflection, and retries with it in context. Stress that no weights update. Name the four components: actor, evaluator, reflection module, episodic memory. Attribute to Shinn et al. 2023. Close with the two main failure modes: bad evaluator and unfiltered memory retrieval.
Real products, models, and research that use this idea.
- Cursor and Cline coding agents store a per-task scratchpad of what they tried; on a failed test, the next iteration reads the scratchpad to avoid repeating the mistake.
- Anthropic claude-code uses a Reflexion-style outer loop when running a long refactor: failed test output becomes a reflection that informs the next edit attempt.
- Voyager (an open-ended Minecraft agent built on GPT-4) used a Reflexion-style skill library where failed attempts produced reflections that informed future skill acquisitions.
- OpenAI's o3 reasoning model and GPT-5.5 with extended thinking embed Reflexion-style self-correction internally within their hidden reasoning loop, generating self-critiques before emitting the visible answer.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does Reflexion differ from self-refine, in one sentence?
QWhy is the evaluator a load-bearing component of the Reflexion loop?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Calling Reflexion a fine-tuning method or a weight update. The whole point is that no weights change; the learning lives in a self-written reflection that is fed back as in-context input.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.