Skip to content
LgPy

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.
PackageWhat it gives youInstall
langgraphStateGraph, Command, Send, interrupt, the Functional API (entrypoint, task), policies, InMemorySaver, InMemoryStorepip install langgraph
langgraph-prebuiltToolNode, tools_condition, InjectedState, InjectedStore, ToolRuntime. Installed with langgraph.(dependency)
langchaincreate_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 integrationspip install langchain-anthropic
langgraph-checkpoint-sqlite, langgraph-checkpoint-postgresDurable checkpointers (and PostgresStore)pip install langgraph-checkpoint-postgres
langgraph-sdkClient for a LangGraph server (get_client), used by RemoteGraphpip install langgraph-sdk
langgraph-clilanggraph dev, build, up, deploy for LangGraph servers and LangSmith Deploymentpip install "langgraph-cli[inmem]"

LangGraph needs Python 3.10 or later.

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_agent
from langchain.tools import tool
from langgraph.checkpoint.memory import InMemorySaver
@tool
def 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.

TopicTutorialReference
State, reducers, nodes, edges, compile()Ch. 1StateGraph, Channels
create_agent, routing, loopsCh. 2Prebuilt nodes
Supervisor, parallel workers, handoffs, subgraphsCh. 3Command and Send
Tools, ToolNode, tool errors, injected state/storeCh. 4Prebuilt nodes, Runtime and managed values
Checkpointers, threads, time travel, StoreCh. 5Checkpointers, Store
Streaming, v2 typed output, debuggingCh. 6Streaming modes
interrupt(), Command(resume=...), approvalsCh. 7Command and Send
Agent middleware, error handlersCh. 8—
Retry, timeout and cache policies, set_node_defaultsCh. 10 (when to use them)StateGraph: node policies (canonical)
Map-reduce, reflection, Functional APICh. 9Functional API
Deployment, durability, testingCh. 10Production guide, RemoteGraph, Graceful shutdown
Tracing and redactionObservabilityTracePolicy
Node caching backends—Cache backends
ImportSymbols
langgraph.graphStateGraph, START, END, MessagesState, add_messages
langgraph.graph.messageadd_messages, REMOVE_ALL_MESSAGES
langgraph.typesCommand, Send, interrupt, Interrupt, RetryPolicy, TimeoutPolicy, CachePolicy, Durability, StreamMode, StreamPart, GraphOutput, StateSnapshot, Overwrite, StreamWriter
langgraph.errorsGraphRecursionError, NodeError (error-handler argument), NodeTimeoutError, GraphInterrupt, InvalidUpdateError
langgraph.funcentrypoint, task
langgraph.runtimeRuntime, get_runtime
langgraph.managedIsLastStep, RemainingSteps
langgraph.configget_config, get_store, get_stream_writer
langgraph.checkpoint.memoryInMemorySaver (MemorySaver is an older alias of the same class)
langgraph.checkpoint.sqlite, langgraph.checkpoint.postgresSqliteSaver, AsyncSqliteSaver, PostgresSaver, AsyncPostgresSaver
langgraph.store.memory, langgraph.store.sqlite, langgraph.store.postgresInMemoryStore, SqliteStore, AsyncSqliteStore, PostgresStore, AsyncPostgresStore
langgraph.graph.uipush_ui_message, delete_ui_message, ui_message_reducer, UIMessage (generative UI, Ch. 6)
langgraph.cache.memoryInMemoryCache
langgraph.prebuiltToolNode, tools_condition, InjectedState, InjectedStore, ToolRuntime
langgraph.pregel.remoteRemoteGraph
langchain.agentscreate_agent, AgentState
langchain.agents.middlewareAgentMiddleware, before_model, after_model, wrap_model_call, wrap_tool_call, dynamic_prompt, and the built-in middleware classes

These are the values in the installed source. Several older pages and blog posts give different numbers.

SettingValue
Default recursion_limit10007 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 modesSeven 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_modeinvoke uses "values" (returns the final state); stream uses the graph’s own default, "updates".
Node timeoutsadd_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 handlingDefault 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 checkpointerinvoke returns with an __interrupt__ key, but the run cannot be resumed. Compile with a checkpointer and pass a thread_id.
InMemoryStore TTLNot 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).

A compiled graph has a few helpers that are easy to miss.

from typing_extensions import TypedDict
from pydantic import BaseModel, Field
from langgraph.graph import StateGraph, START, END
from langgraph.cache.memory import InMemoryCache
from 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 inline
print(sorted(graph.get_graph(xray=True).nodes)) # ['__end__', '__start__', 'inner:count']
print(graph.get_graph().draw_mermaid()[:40])
# Subgraphs and JSON schemas
print([name for name, _ in graph.get_subgraphs()]) # ['inner']
print(sorted(graph.get_input_jsonschema()["properties"])) # ['text', 'word_count']
# Invalidate node caches
graph.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"]) # 3
DeprecatedUse 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_executorlangchain.agents.AgentState
HumanInterrupt, HumanInterruptConfig, ActionRequest (langgraph.prebuilt.interrupt)HumanInTheLoopMiddleware and its HITLRequest/HITLResponse types in langchain.agents.middleware.human_in_the_loop
ValidationNodeToolNode with a Pydantic args_schema on each tool, or your own validation node
MessageGraphStateGraph(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/streamdurability=
ShallowPostgresSaverPostgresSaver with durability="exit"
SymptomCauseFix
ValueError: Checkpointer requires ... thread_idGraph compiled with a checkpointer, invoked without a threadPass {"configurable": {"thread_id": "..."}}
State does not carry over between callsNo checkpointer, or a different thread_id each timeCompile with a checkpointer and reuse the thread ID
A list field is overwritten instead of appendedNo reducer on the fieldAnnotated[list, operator.add] or add_messages
InvalidUpdateError: Expected dict, got [Send(...)]A node returned a bare list of Send objectsReturn 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 nodestimeout= (or a set_node_defaults timeout) reaches a sync node, including a sync error handlerMake the node async def
Error handler raises TypeError: missing 1 required positional argumentHandler parameter not annotated as NodeErrordef handler(state, error: NodeError)
GraphRecursionError after many stepsA loop with no exit conditionFix the routing; set recursion_limit