Intermediate10 min
ReAct: The Core Pattern
The Reason-Act loop that powers every LangGraph agent: think, pick a tool, observe the result, repeat until done.
Quick Reference
- →ReAct = Reasoning + Acting: the LLM alternates between generating thoughts and executing tool calls
- →LangGraph implements ReAct as a cycle: agent node (LLM) → tool node → agent node → ... → END
- →The agent decides to stop when it generates a response without any tool_calls in the AIMessage
- →Structured tool schemas with clear descriptions are critical — the LLM reads them to decide which tool to use
- →Add a recursion_limit to the graph to prevent infinite loops (default is 25 in LangGraph)
What is ReAct?
Definition
ReAct (Reason + Act) is the foundational agent pattern: the LLM generates a thought about what to do next, executes a tool action, observes the result, and repeats until it has enough information to respond.
Every agent framework implements some variation of ReAct. In LangGraph, it maps directly to a graph with two nodes and a conditional edge: the agent node calls the LLM, the tool node executes tool calls, and a conditional edge checks whether the LLM is done or wants to call more tools.
The loop runs until the LLM decides it has enough information to respond