liveBook · Manning

ReAct

As explained in Domain-Specific Small Language Models

An agent framework that interleaves reasoning and tool use to solve tasks by iterating toward a solution.

ReAct (reasoning and acting) is an agent framework that interleaves problem analysis with tool use. An LLM selects tools, observes their outputs, and iterates toward a solution rather than answering in one pass. section 13.4 section 13.5

A ReAct workflow typically involves:

  • Analyzing the user’s task and breaking it into steps. section 13.5
  • Selecting an available tool for the next step. section 13.4
  • Executing the action and using its output to guide subsequent actions. section 13.5
  • Repeating until the task reaches a solution or execution stops. section 13.4

A practical implementation needs an LLM, memory manager, and tool set. In smolagents, CodeAgent expresses actions as executable Python snippets; configured tools and safe execution rules constrain what it can do. Custom tools extend the workflow for domain-specific automation. section 13.4 section 13.5

Flight search and booking

Given “Find a flight from Dublin to New York and then select a seat,” an agent can call a flight-search tool, pass the selected flight to a seat-finding tool, and then invoke a booking tool. A sample run books flight DUB-JFK789 with seat B26. section 13.4

Figure 13.5 The logical workflow of CodeAgent

Shows the logical workflow connecting the model, memory, tools, generated actions, and iterative execution. section 13.4

How Domain-Specific Small Language Models covers it

How deep it goes
Explains the iterative loop and demonstrates executable Python actions, without developing a formal theory of reasoning.
Examples
Uses flight search, seat selection, and ticket booking as chained actions in a travel task.
What it assumes
Assumes an LLM, memory manager, and tools, while introducing Python-based custom tools through docstrings and type hints.
What you can do after
Apply it via smolagents by configuring an LLM, tools, and a CodeAgent for multistep task execution.
How it connects
Connects reasoning and acting with tool use, agent planning, memory managers, and multistep workflows.

Also explained in

Compare how 11 books explain ReAct →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Domain-Specific Small Language Models. The section links point to the parts of the book it draws on.