liveBook · Manning

ReAct

As explained in Build AI-Enhanced Web Apps

ReAct is an agentic reasoning technique in which a language model interleaves reasoning about a task with actions that gather information or affect an environment.

ReAct is an agent pattern in which a language model reasons about a request, chooses when to call a tool, and uses the result to form an answer. It is distinct from React, the UI library. section 6.4.2 section 1.3

A LangChain.js ReAct agent brings together three parts:

  • A system prompt that defines the agent’s behavior. section 6.4.2
  • A language model that reasons about the request and decides whether to use a tool. section 6.4.2
  • Tools that take actions, such as Wikipedia search or a retriever converted with createRetrieverTool. Names and descriptions help the model choose a tool. section 6.4.2

Search-backed technical answers

Configure WikipediaQueryRun as a tool, include it in a prompt with an agent_scratchpad placeholder, and create the agent with createReactAgent. When asked a technical question, the agent can search before answering rather than relying only on the model’s existing knowledge. section 6.4.2

In a web app, the agent can be integrated with the Vercel AI SDK. Streamed UI updates show search activity and incoming responses while retaining the existing chat interface. The example application runs with npm run dev –w ch06/chat-rsc-langchain-agents and requires a provider API key. section 6.4.3

How Build AI-Enhanced Web Apps covers it

How deep it goes
Shows agent configuration and web-app integration, but does not detail the model’s internal reasoning mechanism.
Examples
Uses WikipediaQueryRun for technical questions and a chat application that displays search results.
What it assumes
Builds on selecting a model and defining a system prompt; running the examples requires a provider API key.
What you can do after
Apply it via LangChain.js to configure a tool-using agent and integrate its responses into a streamed chat UI.
How it connects
Connects system prompts, language models, tool calling, retrieval, LangChain.js, and streamed UI.

Also explained in

Compare how 11 books explain ReAct →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build AI-Enhanced Web Apps. The section links point to the parts of the book it draws on.