Level: Beginner/Intermediate Technology: Python 3.11+, LangGraph, LangGraph CLI, LangGraph Studio
Table of Contents
- Create your first LangGraph workflow
- 1.1 — AI workflows
- 1.2 — Setting up the environment
- 1.3 — Define a simple workflow
- 1.4 — Execute your workflow
- Add memory to LangGraph workflows
- 2.1 — Memory in workflows
- 2.2 — Use Pydantic templates
- Module 3 — Debug and monitor with LangGraph Studio
- 3.1 — Fix errors locally
- 3.2 — Use interrupts
- 3.3 — Recall of the bases
- Appendices — Full code files
1. Create your first LangGraph workflow
1.1 — AI workflows
Two main categories of workflows
There are two main types of workflows that can be built with LangGraph. The terms used to describe them will likely evolve over time, so it’s best to focus on the underlying concepts.
First type — AI agents (automation of known tasks)
Some workflows automate tasks whose potential path and decision points are known in advance. We can therefore map what needs to be automated. Today we call this an AI agent. What makes AI agents more useful and capable are large language models (LLMs), which help the agent analyze and generate data.
Second type — Agentic AI (autonomous reasoning on steps)
Other workflows take a high-level query and themselves determine the steps needed to accomplish that query. These workflows use LLMs to break the query into tasks and determine when it is complete. One key difference: He is not told in advance the exact steps to follow. We can provide some general tools available, but the system itself determines which tools to use, in what order, and how many iterations are needed to complete the task. Today we call this Agentic AI.
LangGraph Overview
LangGraph is a framework that helps manage the entire lifecycle of any AI workflow, from writing and debugging to deployment and monitoring. It uses a graph model of nodes and edges to represent workflows in your application.
- Nodes: Perform an action, such as calling an LLM or executing a function.
- Edges: are the possible routes between the nodes.
graph TD
START([__start__]) --> node1[Node A\nAppel LLM / Fonction]
node1 -->|edge| node2[Node B]
node1 -->|conditional edge| node3[Node C]
node2 --> END([__end__])
node3 --> END([__end__])
What this training covers
In this training, we will:
- Create a LangGraph application with a basic workflow.
- Install the LangGraph CLI, which allows you to run the application locally.
- Use LangGraph Studio for debugging and monitoring — a web interface to view the graph, set breakpoints before and after nodes, modify data, and restart the application from specific nodes.
Prerequisites: Python and Pip must be installed in their minimum required version.
1.2 — Setting up the environment
LangGraph CLI
The LangGraph CLI allows you to run LangGraph applications on your local machine. It has an extra inmem which enables hot reloading of code changes, allowing them to be tested without restarting the application.
Installation
# Vérifier la version minimale de Python requise
python --version
# Créer un environnement virtuel
python -m venv .venv
# Activer l'environnement virtuel (Windows)
.venv\Scripts\activate
# Installer le LangGraph CLI avec l'extra inmem
pip install "langgraph-cli[inmem]"
LangGraph project structure
Three files are required for a basic LangGraph application:
mon-projet/
├── requirements.txt # Fichier de dépendances (pip) ou pyproject.toml (poetry)
├── basic.py # Fichier Python pour les fonctions du graphe
└── langgraph.json # Fichier de configuration de l'API LangGraph
The project structure facilitates team collaboration and deployment to production. For experiments, you can also use Jupyter Notebooks, but this is not covered in this training.
Create required files
1. Dependencies file — requirements.txt
langgraph
You can also use poetry with a TOML file. In this example, we have a single dependency: LangGraph.
2. Python file — basic.py
For now, we create an empty file which we will fill later:
# basic.py — à compléter
3. LangGraph configuration file — langgraph.json
{
"graphs": {
"basic_graph": "./basic.py:graph"
},
"dependencies": [
"."
]
}
This file has two keys:
graphs: lists the available graphs and their locations. Thebasic_graphkey points to thegraphobject defined inbasic.py.dependencies: list paths to dependencies files. The.indicates to search in the current directory (whererequirements.txtis located).
Important: The variable name in
basic.py(heregraph) must correspond exactly to what is defined inlanggraph.json, otherwise an error will occur at startup.
1.3 — Define a simple workflow
Example: Airport check-in agent
We will build an airport check-in agent which:
- Requests a passenger’s name and flight number.
- Searches this information to verify if the passenger is eligible for an upgrade.
- If yes: include upgrade information in the output message.
- If no: gives standard confirmation.
The three main sections of a LangGraph workflow
Any LangGraph workflow in Python consists of three main sections:
| Section | Description |
|---|---|
| State objects | What we use to track data throughout the workflow |
| Node and helper functions | The concrete logic of each step of the workflow |
| Graph construction | How nodes and edges are connected |
Section 1 — The State object: FlightState
from typing_extensions import TypedDict, Optional
class FlightState(TypedDict):
name: str
flight_number: str
upgrade: Optional[bool]
message: Optional[str]
nameandflight_number: the initial entries, of typestr.upgrade: will beTrueorFalsedepending on the result.message: tracks information to display throughout the workflow.upgradeandmessageare markedOptional— not for strict validation in this example, but to make the LangGraph Studio interface clearer at runtime.
FlightStateinherits fromTypedDict. It is the lightest and simplest form of state object.
Section 2 — The nodes and helper functions
Node check_in
def check_in(state: FlightState) -> FlightState:
state["message"] = (
f"Checking in {state['name']} "
f"on flight {state['flight_number']}."
)
return state
Puts the flight name and number in the message.
Node offer_upgrade
def offer_upgrade(state: FlightState) -> FlightState:
state["message"] = (
f"Upgrade confirmed for {state['name']} ",
f"on flight {state['flight_number']}! Safe travels."
)
return state
Simulates adding an upgrade to the flight by modifying the message.
Node confirm_check_in
def confirm_check_in(state: FlightState) -> FlightState:
state["message"] = (
f"Check-in confirmed for {state['name']} ",
f"on flight {state['flight_number']}! Safe travels."
)
return state
Creates a message that simulates a normal flight check-in.
Helper function check_upgrade
import random
from typing import Literal
def check_upgrade(
state: FlightState
) -> Literal["confirm_check_in", "offer_upgrade"]:
# Simule la recherche du statut depuis une source de données
if random.random() < 0.5:
state["upgrade"] = True
return "offer_upgrade"
state["upgrade"] = False
return "confirm_check_in"
The key difference: this helper function returns a Literal indicating which node to execute next depending on the result. If the passenger has an upgrade, we execute
offer_upgrade; otherwise,confirm_check_in.
In this example, we use a random number with a 50% chance of obtaining an upgrade to simulate a real verification.
Section 3 — Graph construction
from langgraph.graph import StateGraph, START, END
# Créer le builder avec le state object
builder = StateGraph(FlightState)
# Ajouter les nodes
builder.add_node("check_in", check_in)
builder.add_node("offer_upgrade", offer_upgrade)
builder.add_node("confirm_check_in", confirm_check_in)
# Définir les edges
builder.add_edge(START, "check_in")
builder.add_conditional_edges("check_in", check_upgrade)
builder.add_edge("offer_upgrade", END)
builder.add_edge("confirm_check_in", END)
# Compiler le graphe
graph = builder.compile()
Key points:
StateGraph(FlightState): creates the graph by passing it the state object. This allows each function to access and modify the shared state object as it passes through the graph.STARTandEND: special nodes imported from the LangGraph package. Every state graph must have a start node and at least one end node.add_edge(START, "check_in"): creates a direct edge from start tocheck_in.add_conditional_edges("check_in", check_upgrade):check_inhas conditional edges — we pass the helper function which implements the condition and returns which node to execute next.- The two terminal nodes (
offer_upgradeandconfirm_check_in) lead toEND. builder.compile(): compiles the graph and assigns it to thegraphvariable. This variable name must match the one defined inlanggraph.json.
Workflow visualization
graph TD
START([__start__]) --> check_in["check_in\nCrée le message initial"]
check_in -->|"check_upgrade()\nupgrade = True"| offer_upgrade["offer_upgrade\nAjoute l'upgrade au message"]
check_in -->|"check_upgrade()\nupgrade = False"| confirm_check_in["confirm_check_in\nConfirme le check-in standard"]
offer_upgrade --> END([__end__])
confirm_check_in --> END([__end__])
style START fill:#2d6a4f,color:#fff
style END fill:#2d6a4f,color:#fff
style check_in fill:#1565c0,color:#fff
style offer_upgrade fill:#6a1e55,color:#fff
style confirm_check_in fill:#6a1e55,color:#fff
Full file basic.py
from typing_extensions import TypedDict, Optional
class FlightState(TypedDict):
name: str
flight_number: str
upgrade: Optional[bool]
message: Optional[str]
def check_in(state: FlightState) -> FlightState:
state["message"] = (
f"Checking in {state['name']} "
f"on flight {state['flight_number']}."
)
return state
def offer_upgrade(state: FlightState) -> FlightState:
state["message"] = (
f"Upgrade confirmed for {state['name']} ",
f"on flight {state['flight_number']}! Safe travels."
)
return state
def confirm_check_in(state: FlightState) -> FlightState:
state["message"] = (
f"Check-in confirmed for {state['name']} ",
f"on flight {state['flight_number']}! Safe travels."
)
return state
import random
from typing import Literal
def check_upgrade(
state: FlightState
) -> Literal["confirm_check_in", "offer_upgrade"]:
# Simule la recherche du statut depuis une source de données
if random.random() < 0.5:
state["upgrade"] = True
return "offer_upgrade"
state["upgrade"] = False
return "confirm_check_in"
from langgraph.graph import StateGraph, START, END
builder = StateGraph(FlightState)
builder.add_node("check_in", check_in)
builder.add_node("offer_upgrade", offer_upgrade)
builder.add_node("confirm_check_in", confirm_check_in)
builder.add_edge(START, "check_in")
builder.add_conditional_edges("check_in", check_upgrade)
builder.add_edge("offer_upgrade", END)
builder.add_edge("confirm_check_in", END)
graph = builder.compile()
1.4 — Run your workflow
Getting started with the LangGraph CLI
# Aller dans le répertoire contenant les fichiers
cd mon-projet
# Démarrer le serveur local
langgraph dev
This command:
- Starts a local instance of the server.
- Automatically launches a web page with LangGraph Studio.
LangGraph Studio connects to the local instance via the base URL parameter. Everything runs in memory, so nothing is persisted. This configuration allows LangGraph Studio to be used to run and debug a local version of the application. Any code change is detected and reloaded within seconds, saving time.
Step through an execution in LangGraph Studio
Workflow visualization
LangGraph Studio displays a visualization of the workflow with:
- The starting (
__start__) and ending (__end__) node - The
check_innode - Two conditional edges to
offer_upgradeandconfirm_check_in
Inputs and startup
The workflow inputs are displayed in the interface. We note:
- Two required fields:
nameandflight_number - Two optional fields:
upgradeandmessage
Enter the name and flight number values, then click Submit to start the workflow.
Review of the status at each node (thread)
Execution is very fast. We can examine the state at each node for this thread:
- Node
__start__: displays theflight_numberand thenameprovided as input. - Node
check_in: creates the first message. If theoffer_upgradepath is taken, the message is modified to show this. - Final checkpoint: a checkpoint is created at the end of the workflow, showing the final state.
We can restart the check_in node until it takes the other conditional edge. With a 50/50 chance, it shouldn’t take too many tries. We can then see the message from the confirm_check_in node as the final result.
LangGraph Studio Features
Change state and fork an execution
You can edit the state of a node, then fork a new execution from this node with the modified state. For example, we can change the name in the report and click Fork. The message will then be updated to include the new name.
Create a new thread
To create a new thread, click on the corresponding button. You can enter different values to run the workflow again.
Go back to previous threads
We can return to previous threads and examine the results or restart from certain nodes.
Output console
You can view the detailed execution logs and application output messages in the console where langgraph dev was launched.
sequenceDiagram
participant U as Utilisateur
participant S as LangGraph Studio
participant A as Application locale
U->>S: Entrer name + flight_number
U->>S: Cliquer Submit
S->>A: Démarrer le workflow
A->>A: check_in (crée le message)
A->>A: check_upgrade (50/50)
alt upgrade = True
A->>A: offer_upgrade
else upgrade = False
A->>A: confirm_check_in
end
A->>S: État final (checkpoint)
S->>U: Visualiser chaque node + état
Note over U,A: Fork possible depuis n'importe quel node
U->>S: Modifier état + Fork
S->>A: Relancer depuis ce node
A->>S: Nouveau thread
2. Add memory to LangGraph workflows
2.1 — Memory in workflows
Role of memory
Memory helps the LangGraph workflow accomplish complex tasks. Memory can be added by defining a state object — simply a Python object that is passed between nodes. It contains all the information that the workflow is currently tracking.
Options for state objects
| Type | Description | Use cases |
|---|---|---|
| TypedDict | Lightweight and simple to implement | Experimentation, simple workflows |
| Pydantic | Structured data with validation and defaults, excellent for JSON serialization | Production workflows |
| Custom classes | Custom classes for the state object | Complex workflows requiring reacting to data changes or transformations |
| External memory | External memory via LangChain Cloud | Memory tracking across multiple sessions |
TypedDict is lightweight and simple to implement, which works well when experimenting with a workflow.
Pydantic allows you to define structured data, add validation and default values. It’s also great for JSON serialization.
For complex workflows, defining custom classes for state can make it easier to trigger certain changes or perform data transformations.
LangGraph supports external memory via LangChain Cloud, which helps track memory across multiple workflow sessions. We can also manually integrate other memory stores, such as cache systems and databases.
Not all of these options are covered in detail in this training, but they give an idea of what is available.
2.2 — Use Pydantic templates
Converting from TypedDict to Pydantic
Let’s take the simple workflow that uses TypedDict for state and convert it to use a Pydantic model.
Before — with TypedDict:
from typing_extensions import TypedDict, Optional
class FlightState(TypedDict):
name: str
flight_number: str
upgrade: Optional[bool]
message: Optional[str]
After — with Pydantic BaseModel:
from pydantic import BaseModel
from typing_extensions import Optional
class FlightState(BaseModel):
name: str
flight_number: str
upgrade: Optional[bool] = None
message: Optional[str] = None
The key differences:
- We inherit from
BaseModelinstead ofTypedDict. - Optional fields have a default value (
= None) — imposed by Pydantic.
Update node functions
With Pydantic, we access attributes with the dotted notation instead of square brackets:
Before (TypedDict):
def check_in(state: FlightState) -> FlightState:
state["message"] = (
f"Checking in {state['name']} "
f"on flight {state['flight_number']}."
)
return state
After (Pydantic):
def check_in(state: FlightState) -> FlightState:
state.message = (
f"Checking in {state.name} "
f"on flight {state.flight_number}."
)
return state
You can choose Pydantic simply to avoid brackets and quotation marks. Dotted notation is cleaner.
Full file basic2.py (Pydantic version)
from pydantic import BaseModel
from typing_extensions import Optional
class FlightState(BaseModel):
name: str
flight_number: str
upgrade: Optional[bool] = None
message: Optional[str] = None
def check_in(state: FlightState) -> FlightState:
state.message = (
f"Checking in {state.name} "
f"on flight {state.flight_number}."
)
return state
def offer_upgrade(state: FlightState) -> FlightState:
state.message = (
f"Upgrade confirmed for {state.name} "
f"on flight {state.flight_number}! Safe travels."
)
return state
def confirm_check_in(state: FlightState) -> FlightState:
state.message = (
f"Check-in confirmed for {state.name} "
f"on flight {state.flight_number}! Safe travels."
)
return state
import random
from typing import Literal
def check_upgrade(
state: FlightState
) -> Literal["confirm_check_in", "offer_upgrade"]:
# Simule la recherche du statut depuis une source de données
if random.random() < 0.5:
state.upgrade = True
return "offer_upgrade"
state.upgrade = False
return "confirm_check_in"
from langgraph.graph import StateGraph, START, END
# -- Build Graph --
builder = StateGraph(FlightState)
builder.add_node("check_in", check_in)
builder.add_node("offer_upgrade", offer_upgrade)
builder.add_node("confirm_check_in", confirm_check_in)
builder.add_edge(START, "check_in")
builder.add_conditional_edges("check_in", check_upgrade)
builder.add_edge("offer_upgrade", END)
builder.add_edge("confirm_check_in", END)
graph = builder.compile()
Checking in LangGraph Studio
To verify the changes:
- Start LangGraph Studio (
langgraph dev). - Enter the input values.
- Click Submit to run the workflow.
- Verify that it runs without errors.
- Relaunch several times to see the different conditional edges.
3. Debug and monitor with LangGraph Studio
3.1 — Fix errors locally
Identify errors in LangGraph Studio
Running LangGraph Studio locally is a great way to debug your workflows. Here is what we can do:
After entering values and launching the graph, if an error occurs:
- Red error box: appears next to the node in question (eg:
confirm_check_in), to immediately identify where the problem occurred. - Error information: Displayed in the interface — for example, that it was a
TypeError. - Expand tour: allows you to see the node where it happened with the details of the error.
- Error tag: even if a node is reduced, a tag remains visible, which is practical in a large graph.
Output console
For even more information, consult the output console:
- The code that had the error.
- The affected file and line number.
TypeError: can only concatenate str (not "tuple") to str
File "/path/to/basic.py", line 27, in confirm_check_in
Hot reloading
Once the code has been corrected, we look at the console: LangGraph automatically detects the change and reloads the application. This is hot swapping in action. There is no need to restart the server.
Re-run from here — Rerun from a specific node
To quickly test the fix:
- Use the Re-run from here functionality before the node which had an error.
- In this example, the node state
check_inwill be loaded, thenconfirm_check_inwill be called again. - After execution, it can be confirmed that the fix worked.
Note: LangGraph Studio creates a new fork for this node. It remembers previous forks, so we can go back and review them.
graph LR
check_in["check_in\n(état sauvegardé)"] --> fork1["confirm_check_in\n(erreur — fork 1)"]
check_in --> fork2["confirm_check_in\n(corrigé — fork 2)"]
fork1 --> END1([__end__])
fork2 --> END2([__end__])
style fork1 fill:#c62828,color:#fff
style fork2 fill:#2e7d32,color:#fff
3.2 — Use interrupts
What is an interrupt?
Interrupts are like breakpoints that can be set before or after the execution of a node. They allow execution to be paused to examine the state at a specific time.
How to install switches
Method 1 — Via the graph
We hover over a node in the graph, then we select:
- Interrupt Before: pause before node execution
- Interrupt After: pause after node execution
- Both: both
Nodes that have interrupts configured are identifiable by shaded lines in their boxes.
Method 2 — Via the interrupts menu
LangGraph Studio offers a menu listing all the interrupts in the graph. This is an easy way to configure or clear interrupts for all nodes at once.
Example: interrupt before check_in
- Place an interrupt before the
check_innode. - Start graph execution.
- Execution pauses — status can be examined.
- Once ready, click Continue to resume execution.
sequenceDiagram
participant U as Utilisateur
participant S as LangGraph Studio
U->>S: Configurer "Interrupt Before check_in"
U->>S: Submit (démarrer le workflow)
S-->>U: ⏸ PAUSE — état affiché avant check_in
U->>U: Examiner l'état actuel
U->>S: Cliquer Continue
S->>S: Reprendre l'exécution (check_in → suite)
S-->>U: Résultat final
3.3 — Reminder of the basics
LangGraph is a Python application
When running a LangGraph workflow locally, keep in mind that it is a Python application. We can therefore apply all the normal good practices:
- Logger: use a logger to organize what appears in the logs.
- Try/except: use standard Python error handling.
import logging
logger = logging.getLogger(__name__)
def check_in(state: FlightState) -> FlightState:
try:
logger.info(f"Début du check-in pour {state['name']}")
state["message"] = (
f"Checking in {state['name']} "
f"on flight {state['flight_number']}."
)
logger.info(f"Message créé : {state['message']}")
return state
except Exception as e:
logger.error(f"Erreur dans check_in : {e}")
raise
Common errors to watch for
State-related errors
| Error | Description |
|---|---|
| Do not update state between nodes | State is not changed or returned correctly |
| Type mismatch | Mismatch between expected type and actual value |
| Forgetting to return a new state | node function does not return modified state |
Edge-related errors
| Error | Description |
|---|---|
| Missing edges | A node has no exit path |
| Circular edges | Infinite loop between nodes |
| Incorrect condition logic | The condition returns a nonexistent node |
| Duplicate node references | A node is incorrectly referenced several times |
Common errors in node functions
| Error | Description |
|---|---|
| Forgetting to return a result | The function does not return the state |
| Incorrect function signature | Parameters do not match what LangGraph expects |
| Syntax or logic errors | Classic Python Bugs |
Versioning
As with any Python application, keeping LangGraph and associated libraries up to date and using compatible versions helps avoid problems.
# Mettre à jour LangGraph
pip install --upgrade langgraph
# Vérifier les versions installées
pip show langgraph
4. Appendices — Complete code files
Complete project structure (Module 1)
m1/
├── requirements.txt
├── langgraph.json
└── basic.py
requirements.txt
langgraph
langgraph.json
{
"graphs": {
"basic_graph": "./basic.py:graph"
},
"dependencies": [
"."
]
}
basic.py — TypedDict version (Module 1)
from typing_extensions import TypedDict, Optional
# ─────────────────────────────────────────────
# STATE OBJECT
# ─────────────────────────────────────────────
class FlightState(TypedDict):
name: str
flight_number: str
upgrade: Optional[bool]
message: Optional[str]
# ─────────────────────────────────────────────
# NODE FUNCTIONS
# ─────────────────────────────────────────────
def check_in(state: FlightState) -> FlightState:
state["message"] = (
f"Checking in {state['name']} "
f"on flight {state['flight_number']}."
)
return state
def offer_upgrade(state: FlightState) -> FlightState:
state["message"] = (
f"Upgrade confirmed for {state['name']} ",
f"on flight {state['flight_number']}! Safe travels."
)
return state
def confirm_check_in(state: FlightState) -> FlightState:
state["message"] = (
f"Check-in confirmed for {state['name']} ",
f"on flight {state['flight_number']}! Safe travels."
)
return state
# ─────────────────────────────────────────────
# HELPER FUNCTION (conditional edge)
# ─────────────────────────────────────────────
import random
from typing import Literal
def check_upgrade(
state: FlightState
) -> Literal["confirm_check_in", "offer_upgrade"]:
# Simule la recherche du statut depuis une source de données
if random.random() < 0.5:
state["upgrade"] = True
return "offer_upgrade"
state["upgrade"] = False
return "confirm_check_in"
# ─────────────────────────────────────────────
# GRAPH CONSTRUCTION
# ─────────────────────────────────────────────
from langgraph.graph import StateGraph, START, END
builder = StateGraph(FlightState)
builder.add_node("check_in", check_in)
builder.add_node("offer_upgrade", offer_upgrade)
builder.add_node("confirm_check_in", confirm_check_in)
builder.add_edge(START, "check_in")
builder.add_conditional_edges("check_in", check_upgrade)
builder.add_edge("offer_upgrade", END)
builder.add_edge("confirm_check_in", END)
graph = builder.compile()
basic2.py — Pydantic version (Module 2 & 3)
from pydantic import BaseModel
from typing_extensions import Optional
# ─────────────────────────────────────────────
# STATE OBJECT (Pydantic)
# ─────────────────────────────────────────────
class FlightState(BaseModel):
name: str
flight_number: str
upgrade: Optional[bool] = None
message: Optional[str] = None
# ─────────────────────────────────────────────
# NODE FUNCTIONS
# ─────────────────────────────────────────────
def check_in(state: FlightState) -> FlightState:
state.message = (
f"Checking in {state.name} "
f"on flight {state.flight_number}."
)
return state
def offer_upgrade(state: FlightState) -> FlightState:
state.message = (
f"Upgrade confirmed for {state.name} "
f"on flight {state.flight_number}! Safe travels."
)
return state
def confirm_check_in(state: FlightState) -> FlightState:
state.message = (
f"Check-in confirmed for {state.name} "
f"on flight {state.flight_number}! Safe travels."
)
return state
# ─────────────────────────────────────────────
# HELPER FUNCTION (conditional edge)
# ─────────────────────────────────────────────
import random
from typing import Literal
def check_upgrade(
state: FlightState
) -> Literal["confirm_check_in", "offer_upgrade"]:
# Simule la recherche du statut depuis une source de données
if random.random() < 0.5:
state.upgrade = True
return "offer_upgrade"
state.upgrade = False
return "confirm_check_in"
# ─────────────────────────────────────────────
# GRAPH CONSTRUCTION
# ─────────────────────────────────────────────
from langgraph.graph import StateGraph, START, END
builder = StateGraph(FlightState)
builder.add_node("check_in", check_in)
builder.add_node("offer_upgrade", offer_upgrade)
builder.add_node("confirm_check_in", confirm_check_in)
builder.add_edge(START, "check_in")
builder.add_conditional_edges("check_in", check_upgrade)
builder.add_edge("offer_upgrade", END)
builder.add_edge("confirm_check_in", END)
graph = builder.compile()
Summary of key concepts
| Concept | Description |
|---|---|
| StateGraph | Main class to construct a LangGraph graph with a state object |
| State object | Python object passed between nodes to share and track data |
| Node | Python function that receives state, performs an action, and returns the modified state |
| Edge | Direct connection between two nodes (add_edge) |
| Conditional edge | Conditional connection determined by a helper function (add_conditional_edges) |
| START / END | Special nodes imported from langgraph.graph to mark start and end |
| TypedDict | Lightweight Python type to define state object |
| Pydantic BaseModel | Pydantic class to define state object with validation and default values |
| LangGraph CLI | CLI tool to start the application locally (langgraph dev) |
| LangGraph Studio | Web interface to visualize, debug and monitor workflows |
| inmem | LangGraph CLI extra activating hot reloading |
| Hot reloading | Automatic reloading of code changes without restarting the server |
| Interrupt | Breakpoint LangGraph Studio — break before/after a node |
| Fork | New execution branch created from a node with a modified state |
| Thread | Independent execution of the workflow with its own inputs |
| langgraph.json | Configuration file declaring available graphs and dependencies |
Search Terms
langgraph · workflows · ai · agents · orchestration · artificial · intelligence · generative · errors · studio · workflow · pydantic · functions · memory · node · version · basic.py · basic2.py · cli · interrupt · state · typeddict