Qlaudia

← All courses

LangGraph

  • Artificial Intelligence
  • Technology & Computing

Build stateful, multi-step AI workflows by defining nodes as Python functions and edges as control flow paths within a directed graph. Use a shared, typed state schema to pass data across steps, enabling loops, branching, and agent patterns without implicit state management.

Sign in to enroll$1038 lessons

What you'll learn

  • LangGraph GraphA top-level stateful structure that represents a directed workflow where nodes perform units of work, edges define control flow, and a shared state object persists data across the entire execution.
  • NodeA discrete computational unit in a LangGraph graph that accepts the current state, performs work, and returns a dictionary of updates to be merged back into the state.
  • Graph StateThe shared data structure that flows through a LangGraph graph during execution, serving as the central repository that every node reads from and writes to.
  • StateGraphThe central class in LangGraph for building stateful, graph-structured applications where nodes read from and write updates to a shared, typed state object.
  • EdgeA directed connection between two nodes that defines the execution flow and routing instructions in a graph.
  • Graph CompilationThe process of transforming a graph definition into an executable runnable by validating structure, binding schemas, and wiring internal machinery.
  • Conditional EdgeAn edge whose target node is determined at runtime by a routing function based on the current state, enabling decision-making and loop termination in graphs.
  • Message StateA graph state pattern where the state contains an ordered list of LangChain BaseMessage objects representing the full conversation history visible to the LLM.
  • Human-in-the-LoopA design pattern in which an automated workflow deliberately pauses to allow a human to provide input, review output, or grant approval before execution continues.
  • Tool CallingThe capability of an LLM to request execution of external functions by emitting structured payloads that specify which tool to call and what arguments to pass.
  • SubgraphA fully compiled LangGraph graph embedded inside a larger parent graph and executed as a single node, enabling modular composition and encapsulation of complex behaviors.
  • CyclesA graph edge that routes execution back to a previously visited node, enabling iterative loops that are essential for autonomous agents.
  • Tool NodeA built-in LangGraph component that executes tool calls emitted by an LLM and writes the results back into graph state as ToolMessage objects.
  • AgentA graph-based system where a language model decides which tools to invoke at each step within a conditional loop until a goal is reached.
  • BranchingA graph topology pattern where execution diverges into multiple simultaneous paths that may later reconverge, enabling parallel node execution and conditional routing.
  • ReAct Agent PatternA pattern for building LLM-driven agents in which the model alternates between producing explicit reasoning and executing concrete actions until reaching a final answer.
  • MemoryThe ability of a graph to retain and access information across multiple invocations of the same thread, enabling conversational agents to reference prior interactions.
  • Short-Term MemoryThe information a LangGraph graph holds during a single invocation that exists only for the lifetime of one call to graph.invoke() or graph.stream().
  • Parallel Node ExecutionLangGraph's ability to invoke multiple independent nodes simultaneously when graph topology fans out from a single node to multiple targets.
  • Supervisor Agent PatternA multi-agent architecture where a central supervisor node dynamically routes tasks to specialized sub-agents based on the current state until task completion.
  • Graph VisualizationThe rendering of a compiled LangGraph graph as a visual diagram showing nodes and their connections, making it easy to verify structure and identify dead ends or unreachable paths.
  • LangGraph PlatformA managed cloud environment for deploying, hosting, and scaling LangGraph applications in production with built-in persistence, concurrency, long-running task handling, and observability.
  • CheckpointerA persistence component that saves snapshots of the graph state after each node execution and restores them on demand for fault tolerance and human-in-the-loop workflows.
  • Config / ConfigurableA runtime dictionary passed during graph invocation that carries operational parameters like language or user ID to customize behavior without altering the graph structure.
  • END NodeA special sentinel constant that signals graph termination and causes execution to stop and return the current state.
  • Entry PointThe designated first node where graph execution begins every time the graph is invoked.
  • Graph InvocationThe execution of a compiled LangGraph graph that transforms a static blueprint of nodes and edges into a live computation.
  • InterruptA mechanism that pauses graph execution at a specific node boundary so that external input can be provided before the graph resumes from that point.
  • LangGraph StudioA visual integrated development environment for building, inspecting, running, and debugging LangGraph applications through interactive node-and-edge diagrams and live execution inspection.
  • LangSmith TracingAn observability integration that automatically records every step of LangGraph execution—including node invocations, state transitions, and edge decisions—into a structured, browsable trace for debugging and evaluation.
  • Long-Term MemoryInformation persisted in an external store that survives graph runs and can be accessed across different threads, users, or sessions.
  • Multi-Agent ArchitectureA system design where multiple independent agents with their own logic, tools, and state collaborate by passing control or messages between compiled graphs.
  • ReducerA function that controls how a specific field in LangGraph state is updated by combining the new value with the old value according to custom logic instead of overwriting it.
  • Retry PolicyA configuration attached to a node that instructs LangGraph to automatically re-execute that node when it raises an exception, allowing transient failures to be absorbed without halting the graph.
  • State SchemaThe typed blueprint that defines which fields exist on the shared state object, their types, and how each field is updated as a LangGraph graph executes.
  • State UpdateA dictionary returned by a node function that specifies which fields of the shared graph state to change and what their new values should be.
  • StreamingThe ability to emit outputs or state updates incrementally as a LangGraph graph executes, rather than waiting for the entire computation to finish.
  • ThreadAn isolated execution context in LangGraph identified by a unique thread ID that maintains separate persisted state history for each session.

About this course

LangGraph Overview

LangGraph is a Python library built on top of LangChain that lets you design, run, and inspect stateful, multi-step AI workflows as explicit graphs. Instead of writing a linear chain of calls or a tangled nest of conditionals, you define your application as a directed graph — nodes do work, edges decide where control flows next, and a shared state object carries data across every step. The result is a principled way to build AI agents that loop, branch, recover from errors, and collaborate across multiple models or tools.

Why Graphs for AI Workflows?

Early LLM applications were mostly single-shot: send a prompt, receive an answer. As requirements grew more complex — search-then-summarise, plan-then-execute, reflect-and-retry — developers reached for chains (sequential calls) and then agents (LLMs that decide which tool to call). Both approaches run into the same wall: state and control flow are implicit, buried in code that is hard to inspect, test, or modify.

LangGraph makes both explicit:

  • State is a typed schema (a Python TypedDict or Pydantic model). Every node reads from it and writes back to it.
  • Control flow is a graph structure. You can see — and reason about — every path execution might take.

This design mirrors how engineers already think about complex processes: as flowcharts, decision trees, or pipelines with feedback loops.

Core Concepts at a Glance

The five building blocks you will encounter throughout this course are:

ConceptOne-line description
StateA shared data structure passed through every node
NodeA Python function that reads state and returns updates
EdgeA directed connection that routes execution between nodes
Conditional EdgeAn edge whose destination is chosen at runtime by a function
Graph / StateGraphThe container that wires nodes and edges together

Together they form a complete programming model for AI workflows.

The Anatomy of a LangGraph Application

Shared State START Node A (e.g. LLM Call) Condition? yes Node B no Node C retry loop END

A minimal LangGraph application: state flows through nodes, a conditional edge decides whether to loop (retry) or continue to the end.

How Execution Works

When you compile a StateGraph and invoke it:

  1. Execution begins at the special START node and the initial state is set.
  2. LangGraph calls the first node function, passing the current state. The function returns a dictionary of updates.
  3. The framework merges those updates back into the shared state — by default using last-write-wins, but you can define custom reducer functions (e.g. appending to a list instead of overwriting).
  4. Edges (or conditional edge functions) are evaluated to determine the next node.
  5. Steps 2–4 repeat until execution reaches the END node.

This cycle means that loops are first-class citizens. An agent that calls a tool, inspects the result, and decides to call another tool is simply a graph that routes back to an earlier node.

Stateful vs. Stateless Workflows

A key distinction in LangGraph is the difference between a stateless pipeline and a stateful agent:

  • A stateless pipeline runs once and terminates. Each node receives input derived entirely from the previous step. Simple RAG (retrieve-then-generate) pipelines fit here.
  • A stateful agent maintains evolving context — a list of tool call results, a running plan, a conversation history — and revisits nodes multiple times. LangGraph's state schema is what makes this possible without resorting to global variables.

LangGraph also supports persistence (checkpointing state to a database between runs) and human-in-the-loop interrupts, enabling long-running workflows that pause for user approval or external input.

Where LangGraph Fits in the Ecosystem

LangGraph sits above LangChain's component layer (LLMs, tools, retrievers) and below your application layer. You can think of the stack as:

Your Application  ⊃  LangGraph (orchestration)  ⊃  LangChain (components)  ⊃  LLM APIs\text{Your Application} \;\supset\; \text{LangGraph (orchestration)} \;\supset\; \text{LangChain (components)} \;\supset\; \text{LLM APIs}

You do not need to use LangChain components inside your nodes — plain Python functions work fine — but LangGraph's tooling (tracing via LangSmith, pre-built agent architectures) integrates tightly with the broader LangChain ecosystem.

What You Will Build in This Course

Throughout this course you will progress from simple linear graphs to sophisticated multi-agent systems:

  • Single-agent loops — an LLM that repeatedly calls tools until it reaches an answer
  • Branching workflows — pipelines that route to different processing paths based on content classification
  • Subgraphs — modular graphs composed inside larger graphs for clean separation of concerns
  • Multi-agent architectures — supervisor patterns where one agent delegates tasks to specialist agents
  • Persistent, interruptible workflows — stateful applications that can be paused, resumed, and inspected

Each of these patterns builds on the same five primitives introduced above. Mastering state, nodes, and edges is the foundation for everything else.

Key Takeaways

  • LangGraph models AI workflows as directed graphs with explicit state and control flow.
  • Nodes are Python functions; edges (including conditional ones) determine routing.
  • A shared state schema replaces implicit data passing and makes complex loops manageable.
  • The library supports cycles natively, making it suited for agentic (plan-act-observe-repeat) patterns.
  • Concepts scale: the same graph primitives underpin both a two-node chain and a production multi-agent system.
LangGraph — Qlaudia