liveBook · Manning

ReAct

As explained in AI Agents and Applications

A ReAct agent is an agent architecture that interleaves reasoning with actions such as invoking tools and observing their results.

ReAct is an agent architecture that interleaves reasoning with actions. Given a user question, the agent reasons about the next step, invokes a suitable tool, incorporates its result, and either calls another tool or produces a final answer. This dynamic loop handles tasks where the required tools, order, or parameters cannot be hardcoded in advance. section 11.2.1

Figure 11.1 The ReAct pattern alternates between reasoning and action, enabling the agent to process a user question by thinking, calling tools as needed, and following up with further reasoning before delivering the final answer.
figure

The pattern alternates between reasoning and action: analyze the question, call tools when needed, reason over returned information, and conclude with a final answer. section 11.2.1

A practical ReAct implementation depends on explicit tool contracts and observable execution:

  • Describe each tool with clear inputs, expected outputs, and usage conditions; type hints and docstrings can make Python tools discoverable to the LLM. section 11.10
  • Let the LLM select and sequence tools dynamically, such as search_customer → get_orders → calculate_total, instead of hardcoding conditional routing. section 11.10
  • Return structured dictionaries or lists when possible, so the agent can extract fields without parsing unstructured text. section 11.10
  • Inspect state and LangSmith traces to see tool choices, arguments, intermediate results, reasoning steps, latency, token counts, and errors. section 11.10

Travel and accommodation assistant

A LangGraph ReAct agent can search travel information, retrieve weather, and check hotel or B&B availability. When a traveler asks about rooms in Penzance without naming an accommodation type, the agent checks both hotel and B&B tools, combines their results, and reports available rooms and prices. A prebuilt agent replaces custom graph wiring while retaining configurable tools, prompts, state, and remaining-step control. section 11.9.1 section 12.1.3

How AI Agents and Applications covers it

How deep it goes
Explains the reasoning-action loop, tool contracts, orchestration, state inspection, retries, and tracing, but not model internals.
Examples
Demonstrates customer-order workflows, travel and weather lookup, and hotel-plus-B&B availability for Penzance.
What it assumes
Assumes basic LLM tool calling and Python functions, while demonstrating tool registration, prompts, state, and orchestration.
What you can do after
Build it from scratch or with LangGraph’s prebuilt agent, then debug tool choices and execution through state inspection and traces.
How it connects
Connects tool calling, LangGraph, structured outputs, LangSmith, semantic search, APIs, and multi-agent systems.

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 and Applications. The section links point to the parts of the book it draws on.