What is a ReAct agent?
Introduction
Project introduction
What is a ReAct agent?
A normal language model receives messages and returns text. It cannot directly search your database, check an order, or call application code. An agent adds a controlled execution loop around the model so it can request one of the tools your application provides.
In a ReAct agent, the model produces a structured decision. The application reads that decision, validates and executes the requested tool, then returns the result as an observation. The model sees the observation on its next turn and either chooses another action or produces the final answer.
Why does the loop need application control?
The model proposes actions, but application code decides what is actually allowed to run. Tool schemas define valid inputs, a registry limits which functions exist, and an authorization check can pause sensitive actions before they affect the outside world.
The loop also needs a step limit and a trajectory. The step limit prevents an agent from continuing forever, while the trajectory records every action and observation so an engineer can inspect how the result was produced.
One agent turn
Model decision
thought + action
Tool execution
allowlisted function
Observation
returns to state
Final answer
loop completes
Bounded
step limit
Controlled
permissions
Inspectable
trajectory
One turn of the agent loop
01
Read the model decision
Turn the model response into a predictable action, tool name, tool input, or final answer.
02
Execute one allowed tool
Match the requested name to a registered function, validate the request, and run that function.
03
Return the observation
Add the tool result to agent state so the model can decide whether to act again or finish.
Start with a model decision
The first coding problem turns ordinary model text into a structured action.