# createReactAgent

A prebuilt ReAct agent: give it a model and tools, and it runs the loop for you.

AI developers · Part 06: LangChain / LangGraph · Card 11 of 14 · Last updated 2026-10-13

## Analogy

create-next-app for agents. Fast start, and you can eject to a custom graph later.

## Code example

`react-agent.ts`

```typescript
import { createReactAgent } from "@langchain/langgraph/prebuilt";

const agent = createReactAgent({ llm: model, tools: [searchDocs, listOpenPRs] });
const result = await agent.invoke({
  messages: [{ role: "user", content: "How do we roll back a deploy?" }],
});
```

## In an agent

It's the Part 4 loop, prewritten. You already know what it does inside.

## Practice

### Flashcards

- **What is ReAct?** Reason, act (call a tool), observe the result, repeat.

## Questions people ask

### What does createReactAgent do in LangGraph?

It builds a ready-made ReAct agent from a model and a list of tools. It runs the familiar loop for you: call the model, run any tools it asks for, add the results, and repeat until it answers in text. It is the fastest way to get a working agent in LangGraph.

### When should I move from createReactAgent to a custom graph?

When you need more than one loop: a router in front, approvals before write tools, extra fields in state, or several specialist agents. createReactAgent is like create-next-app, a fast start. You can switch to your own StateGraph later without changing your tools.

## Related concepts

- [ReAct](https://studyvisually.com/learn/tech/ai-developers/agents/react-pattern)
- [LangGraph.js](https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/langgraph)
- [Graph state](https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/graph-state)
- [Nodes and edges](https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/nodes-and-edges)

Web page: https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/create-react-agent
Study this card in the app: https://studyvisually.com/app/learn?category=ai-developers&card=create-react-agent
