liveBook · Manning

ReAct

As explained in Prompt Engineering in Practice

ReACT is a prompting pattern for agentic workflows in which a model alternates between reasoning, actions, and observations.

ReAct (reasoning and acting) is a prompt pattern for investigations that cannot be resolved from the initial context. The model identifies an information gap, proposes an action, receives an observation, and reasons again. Unlike chain-of-thought prompting, the reasoning context changes as external evidence arrives. section 9.3

A ReAct turn has three parts:

  • Thought: State what the current evidence supports and what remains unknown. section 9.3
  • Action: Request one useful check, such as querying logs, reviewing deployment history, or running a diagnostic command. section 9.3
  • Observation: Add the check’s result to the context before choosing the next step. section 9.3

In a tool-enabled system, the model emits a structured action request; a runtime executes it and returns the result as an observation. Without tool calling, an engineer can supply each observation manually. Continue until the available evidence supports a conclusion, rather than treating the first plausible explanation as the answer. section 9.3 section 9.3.1

Investigate a stale dashboard

A practical prompt can assign the model an investigation role, ask it to state its current hypothesis and next check, and require a conclusion supported by independent observations. In a three-turn pipeline investigation, hourly runs consistently failed at the transformation stage after 03:00; a schema error repeatedly identified `user_segment`. The resulting diagnosis was that null values arriving from the upstream feed failed strict validation. The proposed response was to handle the nulls or temporarily relax validation, rerun the pipeline, and ask the upstream team whether the change was intentional. section 9.3 section 9.3.1

Choose ReAct when the next useful check depends on the last result. If all relevant signals are available up front, use a direct prompt or chain-of-thought prompting instead; ReAct’s runtime loop adds complexity without supplying new information. section 9.3.1

How Prompt Engineering in Practice covers it

How deep it goes
Works through a three-turn diagnosis and describes tool-runtime handoffs, but demonstrates the loop with manually supplied observations rather than code.
Examples
Traces stale-dashboard diagnosis through repeated hourly transformation failures and a schema error involving `user_segment`.
What it assumes
Assumes familiarity with system and user prompts while demonstrating the loop without requiring tool-calling code.
What you can do after
Practice/perform an observation-led investigation and stop when independent evidence supports a diagnosis and next action.
How it connects
Contrasts chain-of-thought reasoning from fixed context and connects ReAct to system/user prompt separation and prompt sampling.

Also explained in

Compare how 11 books explain ReAct →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Prompt Engineering in Practice. The section links point to the parts of the book it draws on.