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










