React Prompting: Definition and Examples
React Prompting (Reasoning + Acting) is a prompt engineering technique that combines step-by-step reasoning with concrete actions, allowing a language model to alternate between thinking and interacting with external tools to solve complex problems.
Full definition
React Prompting, a portmanteau of "Reasoning and Acting," is a paradigm introduced by researchers from Princeton and Google in 2022. This approach structures a LLM's response into an iterative loop composed of three steps: Thought (reflection on the situation), Action (execution of an action such as a web search or calculation), and Observation (analysis of the obtained result). This cycle repeats until the model has enough information to provide a final answer.
Unlike classic Chain-of-Thought which is limited to internal reasoning, React Prompting allows the model to interact with the outside world. The model can query a database, perform an internet search, execute code, or call an API, then integrate the results into its reasoning. This ability to anchor in real data significantly reduces hallucinations and improves response reliability.
The ReAct pattern has become fundamental in building autonomous AI agents. Frameworks like LangChain, LlamaIndex, or the Claude Agent SDK directly rely on this architecture to orchestrate agents capable of solving multi-step tasks. Each iteration of the Thought-Action-Observation cycle brings the agent closer to the solution, while maintaining an explicit trace of its reasoning.
The effectiveness of React Prompting relies on the synergy between reasoning and action: reasoning guides the choice of relevant actions, while observations enrich reasoning with verified facts. This feedback loop makes the process self-correcting — if an action does not produce the expected result, the model can adjust its strategy in the next iteration.
Etymology
The term "ReAct" is a portmanteau of "Reasoning" and "Acting". It was introduced in the academic paper "ReAct: Synergizing Reasoning and Acting in Language Models" published by Shunyu Yao et al. (Princeton University & Google Brain) in October 2022. The name highlights the central innovation: merging two capabilities previously treated separately in AI research.
Concrete examples
Factual research with verification
Answer the following question using the ReAct format.
Question: Which country won the most medals at the Paris 2024 Olympics?
Thought 1: I need to find the medal standings for the Paris 2024 Olympics. I will search for this information.
Action 1: search("Paris 2024 Olympics medal standings")
Observation 1: [search results]
Thought 2: Based on the results, I can now identify the top country.
Action 2: ...
...
Code debugging with execution
Use the Thought/Action/Observation pattern to debug this Python code.
Thought: The code crashes with an IndexError. I will first execute the code to reproduce the exact error.
Action: execute_code("python script.py")
Observation: IndexError: list index out of range at line 42
Thought: Line 42 accesses index i of a list. I need to check the list size before that line.
Action: execute_code("python -c 'import script; print(len(script.data))'")
...
Comparative product analysis
Using the ReAct cycle, compare the cloud offerings of AWS, GCP, and Azure for hosting a low-traffic API.
At each step:
- Thought: explain what you are looking for and why
- Action: search for pricing or specifications
- Observation: note what you found
Continue until you can formulate a well-argued recommendation.
Practical usage
To apply React Prompting, structure your prompts by explicitly asking the model to alternate between thought phases (Thought) and action phases (Action), followed by observations (Observation). This technique is particularly powerful when the model has access to external tools like web search, code execution, or APIs. In practice, React Prompting is mainly used in autonomous agent systems rather than in manual prompts.
Related concepts
FAQ
What is the difference between React Prompting and Chain-of-Thought?
Are external tools necessary to use React Prompting?
Does React Prompting work with all language models?
See also
How to use this prompt
- Copy the prompt with the button above.
- Paste it into ChatGPT, Claude or your favorite AI assistant.
- Replace the bracketed variables with your details, then refine the result.
About Prompt Guide
Prompt Guide is a free library of 2500+ ready-to-use prompts for ChatGPT, Claude and other AIs, with guides to learn prompting and tools to build and optimize your own prompts.
More definitions
Reasoning Model: Definition and Examples
A reasoning model is a language model designed to break down a problem into intermediate reasoning steps before producing its final answer, improving its ability to solve complex tasks.
Red Teaming: Definition and Examples
Red teaming is an adversarial evaluation method that systematically tests the limits, flaws, and vulnerabilities of an AI system by simulating attacks or malicious uses.
Reflection: Definition and Examples
Reflection is an AI technique where a language model iteratively evaluates and corrects its own responses, analyzing its errors to produce a more accurate and reliable result.
Regularization: Definition and Examples
Regularization is a set of techniques used in machine learning to prevent overfitting by adding constraints or penalties to the model during training.
Reinforcement Learning: Definition and Examples
Reinforcement Learning is a branch of machine learning where an agent learns to make optimal decisions by interacting with an environment and receiving rewards or penalties.
Rephrase And Respond: Definition and Examples
A prompt engineering technique that asks the model to rephrase the user's question in its own words before answering, improving
Get new prompts every week
Join our newsletter.