LangGraph is LangChain’s graph-based agent orchestration library, now the default way to build multi-agent AI systems in 2026. If you see ModuleNotFoundError: No module named ‘langgraph’, you need to install the package separately from langchain itself. Here is the full setup with checkpointer and LangSmith integration.

Step 1: Install langgraph
pip install langgraph
# With persistence (SQLite checkpointer):
pip install langgraph langgraph-checkpoint-sqlite
# With Postgres checkpointer:
pip install langgraph langgraph-checkpoint-postgres
# Full stack (most production deployments):
pip install langgraph langchain langchain-openai langgraph-checkpoint-sqlite
Step 2: Minimal agent example
from langgraph.graph import StateGraph, START, END
from typing import TypedDict
class State(TypedDict):
messages: list
def chat_node(state):
state['messages'].append("Hello from chat_node!")
return state
workflow = StateGraph(State)
workflow.add_node("chat", chat_node)
workflow.add_edge(START, "chat")
workflow.add_edge("chat", END)
app = workflow.compile()
result = app.invoke({"messages": []})
print(result)
Step 3: Add checkpointer for state persistence
from langgraph.checkpoint.sqlite import SqliteSaver
memory = SqliteSaver.from_conn_string(":memory:") # or "sqlite:///state.db"
app = workflow.compile(checkpointer=memory)
config = {"configurable": {"thread_id": "user-123"}}
app.invoke({"messages": []}, config=config)
# State persists across invocations under thread_id
Why this error happens
| Cause | Fix |
|---|---|
| Installed only langchain, expecting langgraph included | pip install langgraph separately |
| Old version of langchain (pre 0.2) | pip install -U langchain langgraph |
| Checkpointer extras missing | pip install langgraph-checkpoint-sqlite |
| Wrong Python version (under 3.9) | Upgrade to Python 3.10+ |
Frequently Asked Questions
What is the difference between langchain and langgraph?
LangChain provides the building blocks (LLM wrappers, retrievers, prompts, tools). LangGraph adds the orchestration layer for multi-step, multi-agent systems using a directed graph of nodes. Use LangChain alone for simple chains; add LangGraph when you have loops, branching, or multiple agents.
Do I need a checkpointer to use LangGraph?
No, you can run graphs without one. But you need a checkpointer for: human-in-the-loop approval, conversation memory across turns, resume-after-crash, or time-travel debugging. SqliteSaver works for dev; PostgresSaver for production.
Can LangGraph run async?
Yes. Define async node functions and call app.ainvoke({…}, config) instead of app.invoke. All checkpointers have async equivalents (AsyncSqliteSaver, AsyncPostgresSaver). Required for FastAPI integration.
Is LangGraph free and open-source?
Yes, MIT licensed. The companion LangGraph Cloud (hosted deployment + observability) is paid SaaS but the library itself is free. Self-host with Docker for production at zero cost.
Does LangGraph work with local LLMs like Ollama?
Yes. Install pip install langchain-ollama then use ChatOllama as your LLM inside graph nodes. Great for capstone projects with no API keys or costs.
