Environment:Langchain ai Langgraph Python Runtime Environment
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Python |
| Last Updated | 2026-02-11 14:00 GMT |
Overview
Python 3.10+ runtime environment with core dependencies for building stateful, multi-actor LLM applications using LangGraph.
Description
This environment defines the base Python runtime and package dependencies required to use the LangGraph framework. All LangGraph libraries require Python 3.10 or higher, with support for CPython and PyPy implementations. The core `langgraph` package depends on `langchain-core` for runnable abstractions, `langgraph-checkpoint` for state persistence, `langgraph-sdk` for API client access, `langgraph-prebuilt` for high-level agent APIs, `pydantic` v2 for data validation, and `xxhash` for fast hashing in cache key generation.
Usage
Use this environment for any LangGraph workflow, whether building a stateful graph, creating a ReAct agent, or deploying via the CLI. This is the mandatory base environment for all LangGraph development.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, or Windows | All major platforms supported |
| Python | >= 3.10 | CPython or PyPy; 3.10, 3.11, 3.12, 3.13 officially classified |
| Disk | 500MB+ | For packages and virtual environment |
Dependencies
System Packages
- No OS-level system packages required for the base library
Python Packages
- `langgraph` >= 1.0.8
- `langchain-core` >= 0.1
- `langgraph-checkpoint` >= 2.1.0, < 5.0.0
- `langgraph-sdk` >= 0.3.0, < 0.4.0
- `langgraph-prebuilt` >= 1.0.7, < 1.1.0
- `pydantic` >= 2.7.4
- `xxhash` >= 3.5.0
Optional Packages (Checkpoint Backends)
- `langgraph-checkpoint-sqlite` >= 3.0.3 (requires `aiosqlite` >= 0.20, `sqlite-vec` >= 0.1.6)
- `langgraph-checkpoint-postgres` >= 3.0.4 (requires `psycopg` >= 3.2.0, `psycopg-pool` >= 3.2.0, `orjson` >= 3.10.1)
- `pycryptodome` (for AES encryption of checkpoint data)
Credentials
The following environment variables may be required depending on usage:
- `LANGGRAPH_API_KEY`: Primary API key for connecting to a LangGraph server
- `LANGSMITH_API_KEY`: Fallback API key (checked if `LANGGRAPH_API_KEY` is not set)
- `LANGCHAIN_API_KEY`: Secondary fallback API key
- `LANGGRAPH_AES_KEY`: AES encryption key for encrypted checkpoint serialization (must be 16, 24, or 32 bytes)
- `LANGGRAPH_DEFAULT_RECURSION_LIMIT`: Override the default recursion limit (default: 10000)
Quick Install
# Install core LangGraph
pip install langgraph
# With SQLite persistence
pip install langgraph langgraph-checkpoint-sqlite
# With Postgres persistence
pip install langgraph langgraph-checkpoint-postgres
# With encryption support
pip install langgraph pycryptodome
Code Evidence
Python version requirement from `libs/langgraph/pyproject.toml:10`:
requires-python = ">=3.10"
Core dependencies from `libs/langgraph/pyproject.toml:26-33`:
dependencies = [
"langchain-core>=0.1",
"langgraph-checkpoint>=2.1.0,<5.0.0",
"langgraph-sdk>=0.3.0,<0.4.0",
"langgraph-prebuilt>=1.0.7,<1.1.0",
"xxhash>=3.5.0",
"pydantic>=2.7.4",
]
API key resolution from `libs/sdk-py/langgraph_sdk/client.py:89-111`:
def _get_api_key(api_key: str | None = NOT_PROVIDED) -> str | None:
"""Get the API key from the environment.
Precedence:
1. explicit string argument
2. LANGGRAPH_API_KEY (if api_key not provided)
3. LANGSMITH_API_KEY (if api_key not provided)
4. LANGCHAIN_API_KEY (if api_key not provided)
"""
if isinstance(api_key, str):
return api_key
if api_key is NOT_PROVIDED:
for prefix in ["LANGGRAPH", "LANGSMITH", "LANGCHAIN"]:
if env := os.getenv(f"{prefix}_API_KEY"):
return env.strip().strip('"').strip("'")
return None
Encryption key validation from `libs/checkpoint/langgraph/checkpoint/serde/encrypted.py:54-59`:
key_str = os.getenv("LANGGRAPH_AES_KEY")
if key_str is None:
raise ValueError("LANGGRAPH_AES_KEY environment variable is not set.")
key = key_str.encode()
if len(key) not in (16, 24, 32):
raise ValueError("LANGGRAPH_AES_KEY must be 16, 24, or 32 bytes long.")
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `ImportError: Pycryptodome is not installed` | Using `EncryptedSerializer` without pycryptodome | `pip install pycryptodome` |
| `ValueError: LANGGRAPH_AES_KEY environment variable is not set` | Using AES encryption without setting the key | Set `LANGGRAPH_AES_KEY` env var (16, 24, or 32 bytes) |
| `ValueError: LANGGRAPH_AES_KEY must be 16, 24, or 32 bytes long` | AES key has incorrect length | Use a key of exactly 16, 24, or 32 bytes |
| `TypeError: Invalid checkpointer provided` | Passing wrong type to `compile(checkpointer=...)` | Use `InMemorySaver`, `SqliteSaver`, `AsyncPostgresSaver`, `True`, `False`, or `None` |
Compatibility Notes
- Python 3.11+: Required for the CLI in-memory server (`langgraph-cli[inmem]` extra)
- Python 3.12+: Some Pydantic internals and asyncio context features are conditionally enabled
- Python 3.13+: SDK runtime module has version-specific code paths
- Python < 3.14: Some serialization features have this upper bound
- Pydantic v2 only: LangGraph requires Pydantic >= 2.7.4; Pydantic v1 is not supported as a primary dependency
- typing_extensions: Uses `TypedDict` from `typing_extensions` (not `typing`) for cross-version compatibility
Related Pages
- Implementation:Langchain_ai_Langgraph_StateGraph_Init
- Implementation:Langchain_ai_Langgraph_Pregel_Invoke
- Implementation:Langchain_ai_Langgraph_Create_React_Agent
- Implementation:Langchain_ai_Langgraph_InMemorySaver_Init
- Implementation:Langchain_ai_Langgraph_Task_Decorator
- Implementation:Langchain_ai_Langgraph_Entrypoint_Decorator