liveBook · Manning

ReAct

As explained in AI Agents in Action, Second Edition

ReAct is an agent reasoning technique that interleaves verbal reasoning with tool actions and observations in a feedback loop.

ReAct is a way for an AI agent to work through a task by repeating three steps: reason about what to do, act through a tool, and observe the result. The observation informs the next decision. An agent can change course when a tool returns unexpected information instead of following its first idea to the end. section 5.1.2

Compare this with chain-of-thought (CoT): CoT works through intermediate reasoning in a single pass. ReAct closes the loop around external actions. Inserting one tool call into a single pass is not enough; the agent must use what it observed to decide what happens next. The loop that calls the model, runs the tool, and returns its result belongs to the agent framework, not the model alone. section 5.1 section 5.1.2

Figure 5.3 The ReAct paradigm of reasoning in a sequential diagram. The agent thought process occurs in the loop, where the LLM first reasons, plans, and then executes the plan. After each execution of a task (tool), the LLM observes the output and then reasons about whether it needs to continue looping or whether the plan has been completed.

Follow the reason–act–observe sequence, including the decision to continue or give a final reply. section 5.1.2

A small tool-using agent

Give an agent two tools that move a year backward or forward. Instruct it to think through a time-travel question, call a tool when calculation is needed, inspect the returned year, and continue before answering. The important step is not merely calling a tool: it is reasoning again after seeing the result. Print the tool trace to check that this happens. section 5.2.2 section 5.5

Use the loop deliberately:

  • Choose it when decisions depend on intermediate results or tools must gather information; skip the extra reasoning for a well-scoped, one-step task. section 5.3
  • Keep the available tools relevant, validate tool results, and cap turns or costs. A bad tool choice can otherwise lead to further bad actions. section 3.2.4 section 5.6
  • Inspect tool traces when the agent's steps are not visible in its final answer. Do not expect identical reasoning traces on every run. section 5.2.2 section 5.1

How AI Agents in Action, Second Edition covers it

How deep it goes
Defines the closed loop, contrasts it with CoT, and demonstrates tool-using instructions without descending into model internals.
Examples
Uses backward-and-forward year tools and a trace-inspection exercise to make the action–observation cycle visible.
What it assumes
Introduces the reason–act–observe cycle in plain steps while requiring available tools for actions and results to inspect.
What you can do after
Build it from scratch as a tool-using agent that inspects results before proceeding, then verify calls in its trace.
How it connects
Connects chain-of-thought, tool calling, agentic loops, and sequential thinking through reasoning informed by observations.

Also explained in

Compare how 11 books explain ReAct →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents in Action, Second Edition. The section links point to the parts of the book it draws on.