ReAct & Reflexion
Learn how interleaving reasoning with actions and self-reflection loops push model capabilities further.
ReAct (Reasoning + Acting) is a prompting paradigm where the model alternates between thinking about what to do and taking actions (like searching, calculating, or calling tools). Instead of trying to answer from memory alone, ReAct lets models gather information dynamically and reason about what they find.
A ReAct prompt defines available actions and instructs the model to alternate between Thought, Action, and Observation steps. The key insight is that writing out reasoning before each action improves action selection, and seeing observations before further reasoning grounds the model in facts.
Reflexion extends ReAct by adding a self-critique loop. After the model produces an answer, it evaluates its own output, identifies errors or weaknesses, and generates an improved version. This can be repeated for multiple iterations. Reflexion has shown 10-20% improvements on coding and reasoning benchmarks.
Prompt Templates
ReAct Reasoning Loop
Implements the ReAct pattern for grounded, tool-augmented reasoning.
Answer this question using a Thought → Action → Observation loop. Available actions: Search(query), Calculate(expression), Finish(answer) Question: [QUESTION] Begin with Thought 1.
Reflexion Self-Critique
Applies Reflexion to improve quality through structured self-critique.
Task: [TASK] Attempt 1: Produce your best solution. Reflection: Critically evaluate your attempt. What errors, gaps, or weaknesses exist? Be specific. Attempt 2: Using your reflection, produce an improved solution that addresses every issue you identified.
Test Your Knowledge
Knowledge Check
1 / 2
What makes ReAct different from standard chain-of-thought prompting?
Key Takeaways
- ✓ReAct interleaves reasoning with tool actions, grounding responses in real data rather than memory alone
- ✓Reflexion adds self-critique loops that can improve accuracy by 10-20% on complex tasks
- ✓Both patterns form the foundation of modern AI agent architectures
Continue Learning
Tree of Thoughts & Self-Consistency
Explore branching reasoning paths and majority-vote strategies to dramatically improve accuracy on hard problems.
Program-Aided Language Models
Combine natural language reasoning with executable code to solve math, data, and logic problems accurately.
Embeddings & Vector Stores
Understand how text becomes searchable vectors and how vector databases power semantic search.