LangGraph (Python): API map and quick reference
One-page map of the LangGraph Python API: which package each symbol comes from, the defaults that matter, deprecations, and where each topic is covered in the tutorial and reference pages.
This page is a map, not a second tutorial. It lists the packages and symbols you use with LangGraph, the defaults worth knowing, and the page where each topic is covered in full. Checked against langgraph 1.2.22, langgraph-prebuilt 1.1.2, langgraph-checkpoint 4.3.2 and langchain 1.5.0 (2026-11-19).
- Learning LangGraph from scratch: start at Chapter 1.
- Looking up a signature: use the reference pages linked in the tables below.
Packages
Section titled “Packages”| Package | What it gives you | Install |
|---|---|---|
langgraph | StateGraph, Command, Send, interrupt, the Functional API (entrypoint, task), policies, InMemorySaver, InMemoryStore | pip install langgraph |
langgraph-prebuilt | ToolNode, tools_condition, InjectedState, InjectedStore, ToolRuntime. Installed with langgraph. | (dependency) |
langchain | create_agent and agent middleware (AgentMiddleware, HumanInTheLoopMiddleware, SummarizationMiddleware, …). This is the recommended way to build a tool-calling agent; it compiles to a LangGraph graph. | pip install langchain |
langchain-anthropic, langchain-openai, … | Chat model integrations | pip install langchain-anthropic |
langgraph-checkpoint-sqlite, langgraph-checkpoint-postgres | Durable checkpointers (and PostgresStore) | pip install langgraph-checkpoint-postgres |
langgraph-sdk | Client for a LangGraph server (get_client), used by RemoteGraph | pip install langgraph-sdk |
langgraph-cli | langgraph dev, build, up, deploy for LangGraph servers and LangSmith Deployment | pip install "langgraph-cli[inmem]" |
LangGraph needs Python 3.10 or later.
Two ways in
Section titled “Two ways in”A tool-calling agent. Use create_agent from langchain. You get the model-and-tools loop, structured output, and middleware hooks without writing the graph yourself. The result is a compiled LangGraph graph, so checkpointers, streaming, interrupts and LangSmith Deployment work as they do for any graph.
from langchain.agents import create_agentfrom langchain.tools import toolfrom langgraph.checkpoint.memory import InMemorySaver
@tooldef get_weather(city: str) -> str: """Return the weather for a city.""" return f"It is sunny in {city}."
agent = create_agent( "anthropic:claude-sonnet-5-5", tools=[get_weather], system_prompt="You are a concise assistant.", checkpointer=InMemorySaver(),)
config = {"configurable": {"thread_id": "user-1"}}result = agent.invoke({"messages": [{"role": "user", "content": "Weather in Paris?"}]}, config)print(result["messages"][-1].content)langgraph.prebuilt.create_react_agent still works but is deprecated (LangGraphDeprecatedSinceV10, removal planned for 2.0). Its pre_model_hook/post_model_hook arguments map to before_model/after_model middleware. See Chapter 8 for middleware and the migration table.
Your own graph. Use StateGraph when you want to control the steps: routing, parallel branches, multi-agent handoffs, approval gates. Chapter 1 builds one from scratch; the StateGraph reference has every builder method.
Where each topic lives
Section titled “Where each topic lives”| Topic | Tutorial | Reference |
|---|---|---|
State, reducers, nodes, edges, compile() | Ch. 1 | StateGraph, Channels |
create_agent, routing, loops | Ch. 2 | Prebuilt nodes |
| Supervisor, parallel workers, handoffs, subgraphs | Ch. 3 | Command and Send |
Tools, ToolNode, tool errors, injected state/store | Ch. 4 | Prebuilt nodes, Runtime and managed values |
| Checkpointers, threads, time travel, Store | Ch. 5 | Checkpointers, Store |
| Streaming, v2 typed output, debugging | Ch. 6 | Streaming modes |
interrupt(), Command(resume=...), approvals | Ch. 7 | Command and Send |
| Agent middleware, error handlers | Ch. 8 | — |
Retry, timeout and cache policies, set_node_defaults | Ch. 10 (when to use them) | StateGraph: node policies (canonical) |
| Map-reduce, reflection, Functional API | Ch. 9 | Functional API |
| Deployment, durability, testing | Ch. 10 | Production guide, RemoteGraph, Graceful shutdown |
| Tracing and redaction | Observability | TracePolicy |
| Node caching backends | — | Cache backends |
Symbols by module
Section titled “Symbols by module”| Import | Symbols |
|---|---|
langgraph.graph | StateGraph, START, END, MessagesState, add_messages |
langgraph.graph.message | add_messages, REMOVE_ALL_MESSAGES |
langgraph.types | Command, Send, interrupt, Interrupt, RetryPolicy, TimeoutPolicy, CachePolicy, Durability, StreamMode, StreamPart, GraphOutput, StateSnapshot, Overwrite, StreamWriter |
langgraph.errors | GraphRecursionError, NodeError (error-handler argument), NodeTimeoutError, GraphInterrupt, InvalidUpdateError |
langgraph.func | entrypoint, task |
langgraph.runtime | Runtime, get_runtime |
langgraph.managed | IsLastStep, RemainingSteps |
langgraph.config | get_config, get_store, get_stream_writer |
langgraph.checkpoint.memory | InMemorySaver (MemorySaver is an older alias of the same class) |
langgraph.checkpoint.sqlite, langgraph.checkpoint.postgres | SqliteSaver, AsyncSqliteSaver, PostgresSaver, AsyncPostgresSaver |
langgraph.store.memory, langgraph.store.sqlite, langgraph.store.postgres | InMemoryStore, SqliteStore, AsyncSqliteStore, PostgresStore, AsyncPostgresStore |
langgraph.graph.ui | push_ui_message, delete_ui_message, ui_message_reducer, UIMessage (generative UI, Ch. 6) |
langgraph.cache.memory | InMemoryCache |
langgraph.prebuilt | ToolNode, tools_condition, InjectedState, InjectedStore, ToolRuntime |
langgraph.pregel.remote | RemoteGraph |
langchain.agents | create_agent, AgentState |
langchain.agents.middleware | AgentMiddleware, before_model, after_model, wrap_model_call, wrap_tool_call, dynamic_prompt, and the built-in middleware classes |
Defaults and limits worth knowing
Section titled “Defaults and limits worth knowing”These are the values in the installed source. Several older pages and blog posts give different numbers.
| Setting | Value |
|---|---|
Default recursion_limit | 10007 super-steps (override with the LANGGRAPH_DEFAULT_RECURSION_LIMIT environment variable, or per run with config={"recursion_limit": 25}). Releases up to 1.0.5 used 25, and 1.0.6 to 1.1.3 used 10000. Since 1.2.17 an explicit recursion_limit equal to the default (10007) is honoured when configs are merged, for example in a subgraph; before, it was treated as unset and the other config’s value won. Set it explicitly for agent loops: the default is not a useful guard against a runaway loop. |
Default durability | "async". Passed to invoke/stream/ainvoke/astream, not to compile(). Options: "sync", "async", "exit". It has no effect without a checkpointer. |
| Stream modes | Seven typed values in StreamMode: values, updates, checkpoints, tasks, debug, messages, custom. "tools" is also accepted at runtime but is not in the Literal. |
Default stream_mode | invoke uses "values" (returns the final state); stream uses the graph’s own default, "updates". |
| Node timeouts | add_node(..., timeout=...) and TimeoutPolicy work on async nodes only. A sync node with a timeout is accepted by add_node and rejected by compile() with ValueError. |
ToolNode error handling | Default catches only argument-validation errors (ToolInvocationError) and returns them to the model; other exceptions propagate. Pass handle_tool_errors=True to catch everything. |
interrupt() without a checkpointer | invoke returns with an __interrupt__ key, but the run cannot be resumed. Compile with a checkpointer and pass a thread_id. |
InMemoryStore TTL | Not supported (supports_ttl is False). Use SqliteStore or PostgresStore with a TTLConfig (Ch. 5). |
checkpointer=True on compile() | Only valid for a subgraph (inherit the parent’s checkpointer). |
Compiled-graph utilities
Section titled “Compiled-graph utilities”A compiled graph has a few helpers that are easy to miss.
from typing_extensions import TypedDictfrom pydantic import BaseModel, Fieldfrom langgraph.graph import StateGraph, START, ENDfrom langgraph.cache.memory import InMemoryCachefrom langgraph.types import CachePolicy
class State(TypedDict): text: str word_count: int
inner = ( StateGraph(State) .add_node("count", lambda s: {"word_count": len(s["text"].split())}, cache_policy=CachePolicy(ttl=60)) .add_edge(START, "count") .compile())graph = ( StateGraph(State) .add_node("inner", inner) .add_edge(START, "inner") .add_edge("inner", END) .compile(cache=InMemoryCache()))
# Diagrams: xray=True expands subgraphs inlineprint(sorted(graph.get_graph(xray=True).nodes)) # ['__end__', '__start__', 'inner:count']print(graph.get_graph().draw_mermaid()[:40])
# Subgraphs and JSON schemasprint([name for name, _ in graph.get_subgraphs()]) # ['inner']print(sorted(graph.get_input_jsonschema()["properties"])) # ['text', 'word_count']
# Invalidate node cachesgraph.clear_cache()
# Expose a graph as a LangChain tool (beta)class CountInput(BaseModel): text: str = Field(description="Text to count")
count_tool = inner.as_tool(args_schema=CountInput, name="word_count", description="Count words in a text")print(count_tool.invoke({"text": "LangGraph builds agents"})["word_count"]) # 3Deprecations
Section titled “Deprecations”| Deprecated | Use instead |
|---|---|
langgraph.prebuilt.create_react_agent (and pre_model_hook/post_model_hook) | langchain.agents.create_agent with middleware |
AgentState, AgentStatePydantic in langgraph.prebuilt.chat_agent_executor | langchain.agents.AgentState |
HumanInterrupt, HumanInterruptConfig, ActionRequest (langgraph.prebuilt.interrupt) | HumanInTheLoopMiddleware and its HITLRequest/HITLResponse types in langchain.agents.middleware.human_in_the_loop |
ValidationNode | ToolNode with a Pydantic args_schema on each tool, or your own validation node |
MessageGraph | StateGraph(MessagesState) |
add_node(..., retry=...), add_node(..., cache=...) | retry_policy=, cache_policy= |
@entrypoint(config_schema=...), get_config_jsonschema() | context_schema=, get_context_jsonschema() |
checkpoint_during= on invoke/stream | durability= |
ShallowPostgresSaver | PostgresSaver with durability="exit" |
Common mistakes
Section titled “Common mistakes”| Symptom | Cause | Fix |
|---|---|---|
ValueError: Checkpointer requires ... thread_id | Graph compiled with a checkpointer, invoked without a thread | Pass {"configurable": {"thread_id": "..."}} |
| State does not carry over between calls | No checkpointer, or a different thread_id each time | Compile with a checkpointer and reuse the thread ID |
| A list field is overwritten instead of appended | No reducer on the field | Annotated[list, operator.add] or add_messages |
InvalidUpdateError: Expected dict, got [Send(...)] | A node returned a bare list of Send objects | Return them from a routing function passed to add_conditional_edges, or return Command(goto=[Send(...), ...]) from the node |
ValueError: Node timeouts are only supported for async nodes | timeout= (or a set_node_defaults timeout) reaches a sync node, including a sync error handler | Make the node async def |
Error handler raises TypeError: missing 1 required positional argument | Handler parameter not annotated as NodeError | def handler(state, error: NodeError) |
GraphRecursionError after many steps | A loop with no exit condition | Fix the routing; set recursion_limit |
Resources
Section titled “Resources”- LangGraph docs: docs.langchain.com/oss/python/langgraph
- Source: github.com/langchain-ai/langgraph
- LangSmith Deployment: docs.langchain.com/langsmith/deployments