Get Started with LangGraph, the Current Way
The tutorial you'll find still imports the wrong thing
Search "LangGraph quickstart" right now and most of what comes back, including the original version of this lesson, opens with the same four lines:
from langgraph.prebuilt import create_react_agent
agent = create_react_agent("anthropic:claude-3-7-sonnet-latest", tools=[search])LangGraph is the graph-based framework this course teaches for building AI agents: a system where each step (a "node") can call a language model, run a tool, or hand off to another step, instead of one long linear prompt. That import above is the first thing almost every quickstart tells you to run.
If you already know Python and have called an LLM API directly, you have everything you need. No prior LangGraph or LangChain experience required. After this lesson, you can: build a working ReAct agent and a hand-rolled conversational graph against LangGraph's current API, and explain exactly which import from the "quickstart" you'll find by searching today is deprecated and why.
The import still works. langgraph.prebuilt.create_react_agent will keep running for a while, because deprecation isn't deletion. But langgraph.prebuilt.create_react_agent's own current reference page carries a plain deprecation notice: it's deprecated in favor of create_agent from the langchain package, "which provides an equivalent agent factory with a flexible middleware system." That notice landed with LangGraph's v1.0 stable release in October 2025, seven months after a tutorial with this exact import was published. The concept didn't change. The import path did, and almost nothing that copies old tutorial code notices, because the old function doesn't throw an error. It just quietly stops being the path anyone maintaining LangGraph wants you on. (That snippet carries a second, unrelated staleness too — more on the model string below.)
This lesson rebuilds both of the original quickstart's examples against the current API, and treats knowing which import is current as a real capability. You'll need it every time a two-year-old blog post or a cached search result hands you working-but-stale code.
Install what you actually need
pip install -U langgraph langchain langchain-anthropicOne change from the original quickstart: langchain and langchain-anthropic are no longer optional "if you want to run the example." create_agent lives in the langchain package now, not in langgraph.prebuilt, so you need it installed even for the simplest agent.
Build a ReAct agent on the current factory
from langchain.agents import create_agent
def search(query: str) -> str:
"""Call to surf the web."""
if "sf" in query.lower() or "san francisco" in query.lower():
return "It's 60 degrees and foggy."
return "It's 90 degrees and sunny."
agent = create_agent(
model="anthropic:claude-opus-5",
tools=[search],
system_prompt="You are a helpful weather assistant.",
)
agent.invoke(
{"messages": [{"role": "user", "content": "what is the weather in sf"}]}
)Two things changed, and only two. The import moved from langgraph.prebuilt to langchain.agents, and the keyword that sets the agent's instructions was renamed from prompt to system_prompt. That second change is the one worth sitting with. If you copy old tutorial code that passes prompt=, it doesn't error. create_agent just accepts the call, has no idea what to do with an unrecognized keyword depending on your installed version, and you end up debugging an agent with no system prompt instead of debugging an import error. A silent failure is worse than a loud one, and this is exactly the shape of bug a stale tutorial hands you.
Everything downstream is unchanged. Both functions return a CompiledStateGraph. .invoke(), .stream(), checkpointing, and everything else you'll do with the compiled graph work identically either way. The migration is narrow, not a rewrite.
One more thing worth catching before you copy this code anywhere: the model string itself dates. claude-3-7-sonnet-latest is what the original quickstart specified, and Anthropic retired that model on February 19, 2026. A request naming it now returns an error, not a slow response. The examples above use claude-opus-5, Anthropic's current flagship model as of this writing — Anthropic's own guidance is to default to it unless a workload specifically calls for a faster or cheaper tier, which is a call this lesson doesn't need to make for you. A model string is exactly the kind of value a tutorial freezes at publish time and never revisits, the same failure mode as the import path this lesson opened with, just one layer lower.
Build the conversational graph by hand
The quickstart's second example never used the deprecated factory at all. It builds a StateGraph directly. That's the part of the original tutorial that's still fully current:
from typing import Annotated, TypedDict
from langchain_core.messages import BaseMessage, HumanMessage, AIMessage
from langgraph.graph import StateGraph
from langgraph.graph.message import add_messages
class State(TypedDict):
messages: Annotated[list[BaseMessage], add_messages]
def conversation_node(state: State) -> State:
messages = state["messages"]
if len(messages) == 0 or all(isinstance(m, HumanMessage) for m in messages):
return {"messages": [AIMessage(content="Hello!")]}
last_msg = messages[-1].content.strip().lower()
if "hello" in last_msg:
return {"messages": [AIMessage(content="How are you?")]}
else:
return {"messages": [AIMessage(content="Goodbye!")]}
def should_end(state: State) -> bool:
messages = state["messages"]
if len(messages) > 0:
last_msg = messages[-1].content.strip().lower()
if "goodbye" in last_msg:
return True
return False
graph = StateGraph(State)
graph.add_node("conversation", conversation_node)
graph.add_edge("START", "conversation")
graph.add_conditional_edges(
"conversation",
should_end,
{True: "END", False: "conversation"}
)
chain = graph.compile()TypedDict, Annotated, add_messages, StateGraph, and conditional edges: none of it moved. That's worth stating plainly, not just implying by omission. LangGraph's deprecation this cycle touched the high-level convenience layer, the agent factory, not the low-level graph-construction primitives this course's next seven lessons are built on. You'll see this exact vocabulary again in lesson 02, going much deeper than a "hello, how are you, goodbye" toy loop.
What this buys you before lesson 02
You now have a working agent built on the current factory, and you know exactly which import to skip when a search result hands you the old one. The rest of this course builds from here: lesson 02 goes deep on state as a typed contract (the State/TypedDict pattern above, generalized), and by lesson 08 you'll extend this same conversational graph with the human-in-the-loop and checkpointing mechanics the original quickstart's own "Deploy & Scale" section only named in a bullet point and never built.
State as a typed contract: what a TypedDict state container actually buys you, and why two different versions of this exact exercise exist in LangGraph's own tutorial history.
Reply here and it goes straight to Rod. Same as replying to one of his emails.