How AI Agents Think and Act: ReAct in 2 minutes
Vinitha V N
SubscribeSign in
How AI Agents Think and Act: ReAct in 2 minutes
Vinitha V N<br>Aug 05, 2026
Share
Imagine asking someone to solve a mystery problem. They just don’t guess the answer at the start or arrive at the answer instantly. They think about what they need, then take an action, look at what they get after the action and then repeat the process until they solve it.<br>That is what ReAct Prompting is, in a nutshell. It is reasoning plus acting.<br>Thanks for reading! Subscribe for free to receive new posts and support my work.
Subscribe
What is ReAct
Standard GenAI models “guess” (although it is not actual guess) the next word based on the information it already has (ie, through the training process). ReAct turns the model into a problem solver on top of the next word prediction. The model will be given access to various tools (like web search, calculators, databases, etc.) and make the model run in a loop<br>The ReAct Loop
Thought - The model plans what to do next based on what it knows so far and the context from the user query
Action - The model chose and execute an action or call a specific tool (Example: Calculator (235*546))
Observation - The model receives the output from the Tool and updates its context
Why do we need ReAct
ReAct is particularly useful when the user query requires some external information or requires date specific references.
The GenAI models are trained to predict the most probable next token based on the previous context. The next token will be the most statistically probable token, but not necessarily the correct token. When asked complex or real-time questions, these models often tend to hallucinate. This is where a Thought + Action loop can be helpful
These models doesn’t have access to your private data or any data that has been updated after a specific date. ReAct will let the model to use tools like Web search or your internal Databases
ReAct in action - Example
User Query “What is the temperature difference between Tokyo and London right now?”<br>Thought 1: I need to find the current temperature in Tokyo first.<br>Action 1: WeatherAPI[” Tokyo”]<br>Observation 1: 28°C, Clear<br>Thought 2: Now I need the current temperature in London.<br>Action 2: WeatherAPI[” London”]<br>Observation 2: 18°C, Light Rain<br>Thought 3: I have both values. I need to calculate 28°C - 18°C = 10°C.<br>Action 3: Calculator [28 - 18]<br>Observation 3: 10<br>Thought 4: I have all the required information.<br>Final Answer: Tokyo is currently 10°C warmer than London.
Technical Deep dive (Optional)
If you are interested to understand how ReAct works under the hood.<br>System Prompt Construction
The ReAct relies on a struct system prompt that will instruct the model to format its output so the backend parser can catch the tool calls. An example system prompt is given below<br>Answer the following questions as best you can. You have access to the following tools:<br>- Weather API [city]: Returns current weather string.<br>- Calculator[expression]: Evaluates a mathematical string.<br>Use the following format:<br>Question: the input question you must answer<br>Thought: comment on what you should do<br>Action: the action to take, should be one of [Weather API, Calculator]<br>Observation: the result of the action<br>... (this Thought/Action/Observation can repeat N times)<br>Thought: I now know the final answer<br>Final Answer: the final answer to the original input question
Step 1: The system prompt will be concatenated with the user’s query and passed to the model to generate next tokens
#user query to LLM<br>Answer the following questions as best you can... [System Prompt]<br>Question: What is the temperature difference between Tokyo and London right now?
Step 2: The LLM begins generating the tokens autoregressively. Following the system prompt instructions, it structures its reasoning and outputs the first action.<br>##LLM output to Orchestrator<br>Thought: I need to find the current temperature in Tokyo first.<br>Action: Weather API[Tokyo]
Step 3: The orchestrator (Example, A Python script) detects the Action pattern from Step 2 output. The orchestrator halts the LLM generation, and calls the tool (or Function) using the input argument<br>#Orchestrator execution<br>Tool Name --> “Weather API”<br>Argument --> “Tokyo”
Step 4: The orchestrator appends the results from the tool call to the conversation history and passes it back to the LLM for next Thought<br>#Orchestrator output to LLM<br>[System Prompt + Question]<br>Thought: I need to find the current temperature in Tokyo first.<br>Action: Weather API[Tokyo]<br>Observation: 28°C, Clear
Step 5: Seeing the conversation, the model continues its generation<br>#LLM output to orchestrator<br>Thought: Now I need to find the current temperature in London.<br>Action: Weather API[London]
Step 6: Next Action will be detected by the orchestrator and calls the Tool (or function).<br>#Orchestrator execution<br>Tool Name --> “Weather API”<br>Argument --> “London”
Step 7: Orchestrator append the output to...