Here's a brief overview of LangGraph, along with important terminology and keywords you should know:
LangGraph is an open-source Python library built on top of LangChain that helps you build stateful, multi-agent applications using graphs. It allows for more control, memory, and complex workflows in language model-based applications.
It is inspired by state machines and computation graphs, enabling complex applications like multi-agent chat systems, decision-making bots, workflows, and more.
A LangGraph is essentially a directed graph where:
Nodes are functions or agents (like LLM calls, tools, etc.).
Edges determine the flow between nodes based on conditions.
A Node is a unit of computation.
Examples:
LLM function call
Tool usage
Prompt template + model
Defines the transition between nodes.
You can define conditional logic to choose which node to run next based on output.
Represents the memory/context during execution.
Carries the data from node to node and allows for stateful computation.
The core abstraction in LangGraph.
You define a StateGraph
object to:
Add nodes
Define edges
Specify entry/exit points
Manage memory/state
A runnable (executable unit) that can maintain and update the state.
Works like an enhanced LangChain Runnable with state tracking.
LangGraph supports cyclical graphs, allowing iteration or recursion, ideal for agents that revise outputs.
LangGraph can manage multiple agents, each as a node, coordinating their interactions through a shared state.
You define the start and stop points of your graph.
Entry node: where the execution begins.
End node: halts the graph execution.
You can update the state at each node using custom logic (e.g., storing chat history, tool results, etc.).
Keyword | Meaning |
---|---|
StateGraph |
Main graph object that controls nodes and transitions |
add_node() |
Adds a processing unit (function/tool/agent) to the graph |
add_edge() |
Connects nodes to define execution order |
add_conditional_edges() |
Adds logic-based routing to nodes |
compile() |
Finalizes the graph for execution |
invoke() |
Executes the compiled graph with an initial state/input |
StatefulRunnable |
LangChain-compatible function with memory handling |
entry_point |
The node where the graph starts |
end_point |
The node where the graph stops |
Multi-agent conversations
Tool-using agents with memory
Conversational workflows with branching
Multi-step LLM pipelines with logic and loops