ReAct means reasoning and acting. An agent assesses what it needs, takes an action through a tool, observes the result, and decides what to do next. The LLM chooses the next step from the current context rather than following a fixed sequence of tool calls. section 4.0 section 4.1.1
A question that takes several steps
To estimate how long a marathon runner would take to reach the Moon at a constant record pace, the agent first looks up the runner’s pace, then the Earth–Moon distance, then calculates the time. Each result determines what it needs to do next; an unhelpful search could prompt a different query. section 4.1 section 4.1.1
A minimal tool-calling implementation follows this loop:
- Send the conversation and available tool definitions to the LLM. Let it choose a tool and supply arguments, or return an answer. section 3.3.3
- Append the assistant’s tool-call message, execute the named function, and append its result as a tool message. section 3.3.3
- Send the updated conversation back to the LLM. Repeat until its response contains no tool calls. section 3.3.3
A structured tool call can replace the original text format of explicit “Thought” and “Action” lines. The reasoning still guides tool selection, but the application no longer has to parse those lines. A fuller implementation separates execution state, tool interfaces, LLM communication, and the methods that run, think, and act; a final-answer tool can produce structured output. section 4.1.2 section 4.9
The loop adapts well to unexpected results, but choosing only the next action can lose sight of a complex task. Watch for repeated searches, unused findings, premature answers, and failed calls retried until the step limit. Planning and reflection address the need to consider overall direction and progress. section 7.1.1
Thought: I need to find Kipchoge's marathon world record pace.
Action: search_web("Kipchoge marathon world record")
Observation: Kipchoge's record is 2:01:09 for 42.195 km (Berlin 2022)
Thought: Now I need the Earth-Moon distance at closest approach.
Action: search_wikipedia("Moon perigee distance")
Observation: The Moon's perigee (closest approach) is 356,500 km
Thought: I can now calculate the time needed.
Action: calculator("356500 / (42.195 / 2.0186) * 1")
Observation: 17,034 hours
Thought: I have enough information to answer.
Final Answer: Approximately 17,000 hours
Follow the thought, action, and observation sequence to see how each tool result changes the next decision before the final answer. section 4.1.1










