By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
A support request is not a straight line. The customer may need a lookup, then a clarification, then a retry, then a human decision. In a plain Python script that flow hides inside nested if statements and a while loop: you cannot see where a request is, cannot pause it halfway, cannot resume it in another process, and cannot tell a retry that is making progress from one that is spinning.
LangGraph makes the flow explicit. State is a dictionary with a typed schema, work happens in named nodes, and edges decide what runs next. The runtime walks that structure one superstep at a time, and it can save the state after each step. If a boxes-and-arrows sketch would help a teammate understand your agent, LangGraph is the executable version of that sketch — and the sketch is what you debug, test and review.
# uv (recommended): the runtime, message helpers, and the agent factory
uv add langgraph langchain-core
uv add langchain # only needed for create_agent in Lesson 10
# pip
python -m venv .venv
source .venv/bin/activate # Windows: .venv/Scripts/activate
pip install -U langgraph langchain-core
pip install -U langchain # optional, for the create_agent lesson
# Colab: prefix each install line with % in the cell
# %pip install -q -U langgraph langchain-coreEvery structural exercise in this path runs without an API key. Anything a live model would do can be replaced by a deterministic function — a router, a classifier, a tool — and model-shaped nodes can be driven by `GenericFakeChatModel` from langchain-core, which returns a scripted list of messages and touches no network. The graph runtime, the checkpointer, the interrupts and the tests are all real; only the model's answers are canned.
from langchain_core.language_models.fake_chat_models import GenericFakeChatModel
from langchain_core.messages import HumanMessage
model = GenericFakeChatModel(
messages=iter(["I can look that up. Could you share the order number?"])
)
reply = model.invoke([HumanMessage("My order arrived with a cracked lid.")])
print(type(reply).__name__, "|", reply.content)A live provider model is a drop-in replacement for the same invoke call — same messages in, same AIMessage out. Examples that need one carry an API key badge. The output shown for those examples illustrates the shape of a model reply; it is not presented as a capture from a live run of this lesson.
Four ideas carry the whole runtime. State is a schema plus the current values. A node is an ordinary function that reads state and returns a partial update. An edge chooses which node runs next. The runtime runs the ready nodes in supersteps, merges their updates, follows the edges and — when a checkpointer is configured — saves a checkpoint after each step.
if buried inside a node is not.interrupt(), surface a payload to a UI and resume with the human's answer instead of polling or blocking a request.The running example is Harbor Support Graph, a support agent for the Harbor Supply store. Lessons 1-7 build the machine — state, nodes, routing, loops, parallel work, checkpointing. Lessons 8-11 add the agent pieces: human approval, tools, the model loop, and observability. Lessons 12-14 test it and turn it into a project. The graph is small on purpose; the point is the pattern, so you can point at every state field and every edge in a review.
Key takeaways
LangGraph makes an agent's control flow explicit: a state schema, named nodes and named edges.
A node reads state and returns a partial update; the runtime merges updates and follows the edges.
The runtime needs no model key — deterministic functions and GenericFakeChatModel cover every structural lesson.
Reach for a graph when the flow branches, retries, pauses or must be resumed; not every script needs one.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.