II · Planning & Control FlowMature★★

ReAct

also known as Reason+Act, Think-Act-Observe Loop

Interleave a single thought, a single tool call, and a single observation per step so the agent reasons over fresh evidence.

This pattern helps complete certain larger patterns —

  • used-byAgentic RAG★★Replace static retrieve-then-generate with autonomous agents that plan, choose sources, retrieve iteratively, reflect, and re-query.
  • used-byLanguage Agent Tree Search·Lift the agent loop into a search tree with a learned value function and backtracking.
  • used-byComputer UseLet the model drive a desktop end-to-end via screenshots plus virtual mouse/keyboard tool calls instead of bespoke per-app APIs.
  • specialisesSelf-Ask★★Have the model emit explicit follow-up sub-questions, answer them (optionally via search), then compose the final answer.
  • specialisesRumination AgentRun a single agent through a protracted think-search-verify-revise-act loop spanning hundreds of tool calls, autonomously re-formulating hypotheses across the run.

Context

A team builds an agent for a task that cannot be answered from the model's parametric knowledge alone — it has to look something up, query a database, search the web, or take an action against a real system. The next step often depends on what the previous tool call returned, so the agent cannot plan all the calls up front. Tool calls cost latency and money and may have side effects, so each one needs to be deliberate.

Problem

Pure chain-of-thought reasoning produces fluent, confident answers that hallucinate the facts a tool would have returned. Pure tool-blasting — calling several tools speculatively per turn — wastes calls on the wrong things, returns more results than the model can use, and gives the agent no chance to think between calls. Without a structured interleave of reasoning and action, the agent either guesses or thrashes, and the loop has no clean place to put a step budget or a termination check.

Forces

  • Tool calls are expensive (latency, cost, side effects).
  • Observations change the right next step.
  • The loop must terminate.

Example

A travel-planning chatbot is asked, 'Find me a flight from Oslo to Tokyo next Tuesday under €800.' It thinks: 'I should check flights.' It calls a flight-search tool. The result shows three options. It thinks again: 'The cheapest is on a Tuesday morning — that fits.' Each step it sees what the previous tool call returned, then decides what to do next.

Diagram

Solution

Therefore:

On each step the agent emits Thought (private reasoning), Action (one tool call), Observation (the tool's result). Repeat until the agent decides to answer. A step budget bounds the loop.

What this pattern forbids. Each step the model may call exactly one tool; reasoning between calls is not actuated.

The smaller patterns that complete this one —

  • usesTool Use★★Let the LLM produce typed calls against an external toolkit instead of producing free-form text the surrounding system has to parse.
  • generalisesCode-as-Action AgentHave the agent emit a code snippet as its action each step, executed in a constrained interpreter, instead of emitting JSON tool calls; tool composition becomes function nesting and control flow inside the snippet.
  • generalisesAugmented LLM★★Build the foundational agent block as an LLM augmented with retrieval, tools, and memory that the model actively chooses to use, rather than a bare-model call.

And the patterns that stand alongside it, or against it —

  • alternative-toPlan-and-Execute★★Plan all the steps once with a strong model, then execute each step with a cheaper model under the plan.
  • alternative-toPlanner-Executor-ObserverAdd an explicit Observer role between Planner and Executor so progress is checked against the plan instead of trusted blindly.
  • composes-withCode Execution★★Let the model emit code, run it in a sandbox, and treat the run as the answer instead of trusting the model to compute in its head.
  • complementsIncremental Model Querying★★Generate plan steps by sequentially querying the model at each step rather than producing the whole plan upfront in one call.
  • alternative-toAgentic Behavior Tree·Borrow the behavior-tree formalism: leaves are LLM calls or tools that return success/failure; a tree of selectors and sequences orchestrates control flow.

Neighbourhood

Click any neighbour to follow the language. Scroll to zoom, drag to pan.

Used in recipes

Used in frameworks

Show 43 more

References

Provenance