Build AI Agents with LangGraph
IntermediateA support assistant as a graph: state, nodes, routing, a tool loop and streaming.
You build
A command-line support assistant for a made-up shop, built as a LangGraph graph: it files a customer message as a status question, a return question or something else, looks the order up in a local data file with a tool, and writes the reply.
You need
- Python you write comfortably: functions, type hints, dictionaries, classes, modules, and running commands in a terminal
- Calling a language model from code: messages and their roles, the system prompt, and asking for an answer that fits a schema (the course Build Your First LLM App in Python is one way to get this)
- How an AI agent works as a loop: the model is called with messages and tool definitions, your code runs the tool calls it asks for and sends the results back, until the model answers. You have written or read such a loop in plain Python (the course Build an AI Agent from Scratch in Python is one way to get this)
To build it on your own machine
This is optional and comes with a plan. The course pack brings the starting files, a ready container and a check for every lesson. You need only Docker and git, plus your own AI coding agent if you want a tutor.
What you learn
Your agent loop, redrawn as a graph you can route, watch and test
You already know an agent as a loop of model calls and tool calls. Here you build one as a graph: an order support assistant for a made-up shop that files a customer message, looks the order up with a tool and writes the reply, while unrelated messages go to a person. Each lesson adds one working part, and every part runs on a scripted fake model too, so you can check your work without a key. The course stops at graph basics: no approval steps, crash recovery or deployment.
- State, Nodes and Edges. The three parts every graph is made of: one shared state with a declared shape, nodes that are plain functions returning what they change, and edges that say what runs next. Reducers decide how each update is merged, which is how a list of messages grows instead of being replaced.
- Routing. A conditional edge picks the next node from what is in the state. Code decides some paths and the model decides others, in the same graph, and the graph can draw itself so you can check the wiring.
- Tools and the Loop. The loop you know becomes two nodes and an edge back: a model that may ask for a tool, a node that runs the call, and a stop condition you can read. A step limit ends a run that would never finish.
- Running and Trusting It. Stream a run to see each step as it happens, save the state of a conversation so a second message continues it, read that saved state afterwards, and test the graph on a fake model so its checks never depend on a live answer.
Lessons
Your First Graph: State, Nodes and Edges
An agent as a graph, What LangGraph is, State, Nodes
Put a Model in a Node
Chat models, OpenAI-compatible setup, Message objects, Reducers
Route with Conditional Edges
A decision as data, Routing functions, Conditional edges, Drawing the graph
Give the Graph a Tool
Tools from functions, Binding tools, The tool node, Cycles
Watch It Run: Streaming and Saved State
Steps of a run, Stream modes, Checkpointers, Threads
Test the Graph Without a Live Model
What to assert, Testing a node alone, Testing routing, Scripted whole runs
Where it fits
Course 5 of 8 on the AI Engineer path.