Last Updated: 3/11/2026
Installation
Install LangGraph and its dependencies to start building stateful agents.
Install LangGraph
Python
Install the base LangGraph package:
# Using pip
pip install -U langgraph
# Using uv (faster alternative)
uv add langgraphJavaScript/TypeScript
Install LangGraph for JavaScript/TypeScript:
# Using npm
npm install @langchain/langgraph @langchain/core
# Using pnpm
pnpm add @langchain/langgraph @langchain/core
# Using yarn
yarn add @langchain/langgraph @langchain/core
# Using bun
bun add @langchain/langgraph @langchain/coreInstall LangChain (Optional)
While LangGraph can be used standalone, most examples use LangChain for LLM integrations and tool definitions.
Python
# Using pip (requires Python 3.10+)
pip install -U langchain
# Using uv
uv add langchainJavaScript/TypeScript
# Using npm
npm install langchain
# Using pnpm
pnpm add langchain
# Using yarn
yarn add langchain
# Using bun
bun add langchainInstall LLM Provider Packages
To use specific LLM providers, install their integration packages:
Python Examples
# OpenAI
pip install langchain-openai
# Anthropic
pip install langchain-anthropic
# Google
pip install langchain-google-genaiJavaScript Examples
# OpenAI
npm install @langchain/openai
# Anthropic
npm install @langchain/anthropic
# Google
npm install @langchain/google-genaiFor a complete list of integrations, see the LangChain integrations documentation .
Verify Installation
Python
Create a simple test script:
from langgraph.graph import StateGraph, START, END
from typing_extensions import TypedDict
class State(TypedDict):
value: int
def add_one(state: State) -> dict:
return {"value": state["value"] + 1}
graph = StateGraph(State)
graph.add_node("add_one", add_one)
graph.add_edge(START, "add_one")
graph.add_edge("add_one", END)
app = graph.compile()
result = app.invoke({"value": 0})
print(result) # {'value': 1}JavaScript/TypeScript
Create a simple test script:
import { StateGraph, StateSchema, START, END } from "@langchain/langgraph";
import { z } from "zod";
const State = new StateSchema({
value: z.number(),
});
const graph = new StateGraph(State)
.addNode("addOne", (state) => ({ value: state.value + 1 }))
.addEdge(START, "addOne")
.addEdge("addOne", END)
.compile();
const result = await graph.invoke({ value: 0 });
console.log(result); // { value: 1 }Next Steps
- Quickstart: Build your first calculator agent
- Core Concepts: Understand state, nodes, and edges
- Building Graphs: Learn the Graph API in depth
Troubleshooting
Python Version Requirements
LangGraph requires Python 3.9 or higher. LangChain requires Python 3.10 or higher.
Check your Python version:
python --versionDependency Conflicts
If you encounter dependency conflicts, try creating a fresh virtual environment:
# Using venv
python -m venv langgraph-env
source langgraph-env/bin/activate # On Windows: langgraph-env\Scripts\activate
pip install langgraph
# Using conda
conda create -n langgraph-env python=3.11
conda activate langgraph-env
pip install langgraph