TechByteByByte

Building Agents with LangGraph's Prebuilt Tools

Meet create_react_agent, LangGraph's own native agent constructor, and get a precise, honest answer to a question you've probably been wondering since Module 1: how does this relate to LangChain's create_agent?

#LangGraph#create_react_agent#Agents#create_agent

Recall exactly what you built in Module 14: state, a model node, a ToolNode, tools_condition, and a loop-back edge — five real, deliberate pieces, assembled by hand. This module introduces the shortcut that skips writing all five every time, and then answers a question this course has been quietly setting up since its very first module: how does this actually relate to create_agent, which you already know from LangChain?

The shortcut

from langgraph.prebuilt import create_react_agent
from langchain.chat_models import init_chat_model
from langchain.tools import tool

@tool
def get_weather(city: str) -> str:
    """Get the current weather for a city."""
    return f"It's 22°C and sunny in {city}."

agent = create_react_agent(model=init_chat_model("openai:gpt-4o-mini"), tools=[get_weather])

result = agent.invoke({"messages": [{"role": "user", "content": "What's the weather in Nairobi?"}]})
print(result["messages"][-1].content)

One function call, and the entire graph from Module 14 — state schema, model node, ToolNode, tools_condition, loop-back edge — is built for you. create_react_agent is LangGraph’s own, native, official constructor for exactly this shape.

The real, precise answer to the question you’ve probably been asking

Recall Module 1’s own honest note: create_agent, from your LangChain course, is built directly on top of LangGraph. Now you can see exactly what that means, concretely, because you’ve built the underlying graph yourself, twice — once entirely by hand in Module 14, and once through this module’s shortcut.

flowchart TD
    A["create_react_agent\n(langgraph.prebuilt)\nLangGraph's own, original,\nnative agent constructor"] --> C["The same underlying graph shape:\nmodel node + ToolNode +\ntools_condition + loop-back edge"]
    B["create_agent\n(langchain.agents)\nLangChain 1.0's newer,\nhigher-level wrapper"] --> C

Both genuinely build the same real shape — the exact graph from Module 14. create_react_agent is LangGraph’s own, original, slightly lower-level constructor. create_agent is LangChain’s newer, higher-level wrapper, adding conveniences on top — recall from your LangChain course things like its structured response_format handling and its integrated middleware system. Neither one is “more real” than the other; they’re two different, genuine doors into the identical underlying engine, maintained by overlapping teams, built for slightly different levels of convenience versus direct control.

A concrete, honest comparison

# LangGraph's own, native constructor
from langgraph.prebuilt import create_react_agent
agent_a = create_react_agent(model=init_chat_model("openai:gpt-4o-mini"), tools=[get_weather])

# LangChain's higher-level wrapper
from langchain.agents import create_agent
agent_b = create_agent(model=init_chat_model("openai:gpt-4o-mini"), tools=[get_weather])

For the genuinely common case — a model, some tools, a loop — these two produce functionally near-identical results. The real, honest reason to prefer one over the other comes down to what you need beyond that common case: create_agent’s LangChain-native conveniences (middleware, its particular structured-output handling) if you’re already deep in the LangChain ecosystem, or create_react_agent’s slightly more direct proximity to LangGraph’s own primitives if you know you’ll soon need to customize the underlying graph further — which is exactly what the rest of this course teaches you to do.

When you’d skip both, and build the raw graph yourself

Recall Module 14’s manual version one more time. Neither prebuilt constructor genuinely gives you the same level of control you had there — inserting a genuine audit node between the tool call and the next model turn, as Module 14’s final example did, isn’t something either shortcut naturally accommodates. The honest, practical rule:

Reach for create_react_agent or create_agent when your workflow is genuinely the standard shape — a model, tools, a loop, nothing more structurally unusual. Build the graph directly, the way Module 14 did, the moment you need a real, custom step inserted into that loop itself.

The real, closing idea this entire course has been building toward

Recall this module’s title promise. Here it is, stated plainly, now that you’ve earned it directly through your own, hand-built work: an agent is not a separate, special kind of thing. It’s a graph — state, a model node, a tool node, and a loop — nothing more exotic than that. Every “agent” you’ve ever used, in any framework, including the ones in your LangChain course, is this same real shape underneath, whether or not the tool you used to build it ever showed you the graph directly.

Common mistakes worth avoiding

Assuming create_react_agent and create_agent are fundamentally different, competing tools. Recall this module’s own diagram — they build the same real underlying shape, through two different, real doors. Choosing between them is a genuine convenience decision, not a decision about which one is “correct.”

Reaching for a prebuilt constructor when you already know you’ll need custom control flow. If you can already picture needing an audit step, a genuine human-approval gate, or multi-agent handoff — all covered in upcoming modules — building the raw graph from the start, as Module 14 taught, avoids fighting a prebuilt shortcut’s assumptions later.

Forgetting that both constructors are still genuinely LangGraph underneath. Recall Module 6’s GraphRecursionError — it applies identically to a graph built with create_react_agent, create_agent, or entirely by hand. The engine is the same in all three cases.

What you should take away from this module

  • create_react_agent is LangGraph’s own, native, prebuilt agent constructor — building the exact graph shape from Module 14, in one function call.
  • create_agent (LangChain) and create_react_agent (LangGraph) genuinely build the same underlying shape — two real doors into the same engine, not competing implementations.
  • Reach for either prebuilt constructor for the standard model-tools-loop shape; build the raw graph directly the moment you need genuine, custom control flow inside that loop.
  • An agent is, completely and honestly, just a graph — state, nodes, a loop — nothing more mysterious than what you’ve now built with your own hands, twice.

Where this goes next

You’ve now completed the foundational arc of this course — state, nodes, edges, routing, reducers, messages, loops, and agents, built from first principles. The next module turns to Checkpointing, the real mechanism that finally, honestly answers Module 1’s original, still-unresolved question: how does a workflow genuinely persist, and recover, across real time.

Author
TechByteByByte Editorial Team
Reviewed by
TechByteByByte Admin
Published
Last reviewed