LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Graphs
    • Functional API
    • Pregel
    • Checkpointing
    • Storage
    • Caching
    • Types
    • Runtime
    • Config
    • Errors
    • Constants
    • Channels
    • Agents
    LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewGraphsFunctional APIPregelCheckpointingStorageCachingTypesRuntimeConfigErrorsConstantsChannelsAgents
    LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph

    langgraph

    Description

    🦜🕸️ LangGraph

    PyPI - Version PyPI - License PyPI - Downloads Open Issues Twitter

    Looking for the JS/TS version? Check out LangGraph.js.

    To help you ship LangGraph apps to production faster, check out LangSmith. LangSmith is a unified developer platform for building, testing, and monitoring LLM applications.

    Quick Install

    uv add langgraph

    🤔 What is this?

    LangGraph is a low-level orchestration framework for building, managing, and deploying long-running, stateful agents. LangGraph provides the infrastructure for durable execution, streaming, human-in-the-loop, persistence, memory, and more.

    We recommend you use LangGraph when you have advanced needs that require a combination of deterministic and agentic workflows, heavy customization, and carefully controlled latency. Use LangChain when you want to quickly build agents and applications powered by LLMs using pre-built agent architectures and model integrations.

    LangChain agents are built on top of LangGraph in order to provide durable execution, streaming, human-in-the-loop, persistence, and more. (You do not need to know LangGraph for basic LangChain agent usage.)

    Trusted by companies shaping the future of agents – including Klarna, Replit, Elastic, and more – LangGraph is used to ship AI applications at scale.

    📖 Documentation

    For full documentation, see the API reference. For conceptual guides, tutorials, and examples on using LangGraph, see the LangGraph Docs. Get started with the LangGraph Quickstart.

    📕 Releases & Versioning

    See our Releases and Versioning policies.

    💁 Contributing

    As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.

    For detailed information on how to contribute, see the Contributing Guide.

    Acknowledgements

    LangGraph is inspired by Pregel and Apache Beam. The public interface draws inspiration from NetworkX. LangGraph is built by LangChain Inc, the creators of LangChain, but can be used without LangChain.

    Classes

    Class

    GraphInterruptEvent

    Graph lifecycle event emitted when execution pauses for interrupts.

    Class

    GraphResumeEvent

    Graph lifecycle event emitted when execution resumes from a checkpoint.

    Class

    GraphCallbackHandler

    Base class for graph-level lifecycle callbacks.

    Subclass this handler to observe graph lifecycle transitions that are specific to LangGraph execution, rather than generic LangChain runnable callbacks

    Class

    LangGraphDeprecationWarning

    A LangGraph specific deprecation warning.

    Class

    LangGraphDeprecatedSinceV05

    A specific LangGraphDeprecationWarning subclass defining functionality deprecated since LangGraph v0.5.0

    Class

    LangGraphDeprecatedSinceV10

    A specific LangGraphDeprecationWarning subclass defining functionality deprecated since LangGraph v1.0.0

    Class

    LangGraphDeprecatedSinceV11

    A specific LangGraphDeprecationWarning subclass defining functionality deprecated since LangGraph v1.1.0

    Class

    ToolOutputMixin

    Class

    TaskPayload

    Payload for a task start event.

    Class

    TaskResultPayload

    Payload for a task result event.

    Class

    CheckpointTask

    A task entry within a CheckpointPayload.

    The keys present depend on the task's state:

    • Error: id, name, error, state
    • Has result: id, name, result, interrupts, state
    Class

    CheckpointPayload

    Payload for a checkpoint event.

    Class

    ValuesStreamPart

    Stream part emitted for stream_mode="values".

    data contains the full state after each step, as returned by read_channels().

    Class

    UpdatesStreamPart

    Stream part emitted for stream_mode="updates".

    data maps node names to their outputs. May also contain __interrupt__ (tuple of Interrupt dicts) and __metadata__ keys.

    Class

    MessagesStreamPart

    Stream part emitted for stream_mode="messages".

    data is a 2-tuple of (message, metadata) where message is a BaseMessage (e.g. AIMessageChunk) and metadata is a dict containing keys like

    Class

    CustomStreamPart

    Stream part emitted for stream_mode="custom".

    data is whatever value was passed to StreamWriter inside a node.

    Class

    CheckpointStreamPart

    Stream part emitted for stream_mode="checkpoints".

    Class

    TasksStreamPart

    Stream part emitted for stream_mode="tasks".

    For task start events, data is a TaskPayload with id, name, input, and triggers keys.

    For task result events, data is a `TaskResultPayloa

    Class

    DebugStreamPart

    Stream part emitted for stream_mode="debug".

    Class

    GraphOutput

    Typed container returned by invoke() / ainvoke() with version="v2".

    Class

    RetryPolicy

    Configuration for retrying nodes.

    Class

    TimeoutPolicy

    Configuration for timing out node attempts.

    Cooperative cancellation

    Timeouts rely on asyncio cancellation. If your node uses synchronous time.sleep() or other CPU-bound work that

    Class

    CachePolicy

    Configuration for caching nodes.

    Class

    TracePolicy

    Configuration for how a node's run is traced.

    Scope: this only transforms what the node's own run records. Child runs created by a traced bound runnable and the root graph run are not affected. P

    Class

    Interrupt

    Information about an interrupt that occurred in a node.

    Changed in version v0.4.0
    • interrupt_id was introduced as a property
    Class

    StateUpdate

    Class

    PregelTask

    A Pregel task.

    Class

    CacheKey

    Cache key for a task.

    Class

    PregelExecutableTask

    Class

    StateSnapshot

    Snapshot of the state of the graph at the beginning of a step.

    Class

    Send

    A message or packet to send to a specific node in the graph.

    The Send class is used within a StateGraph's conditional edges to dynamically invoke a node with a custom state at the next step.

    Imp

    Class

    Command

    One or more commands to update the graph's state and send messages to nodes.

    Class

    Overwrite

    Bypass a reducer and write the wrapped value directly to a BinaryOperatorAggregate channel.

    Receiving multiple Overwrite values for the same channel in a single super-step will raise an `InvalidU

    Class

    ExecutionInfo

    Read-only execution info/metadata for the execution of current thread/run/node.

    Class

    ServerInfo

    Metadata injected by LangGraph Server. None when running open-source LangGraph without LangSmith deployments.

    Class

    RunControl

    Run-scoped control surface for cooperative draining.

    Intended for a single graph run. Create a fresh RunControl per run; reusing a control after request_drain() leaves it drained.

    Safe to call f

    Class

    Runtime

    Convenience class that bundles run-scoped context and other runtime utilities.

    This class is injected into graph nodes and middleware. It provides access to context, store, stream_writer, `prev

    Class

    ErrorCode

    Class

    GraphBubbleUp

    Class

    GraphDrained

    Raised when a graph run exits early due to a drain request.

    This indicates the graph stopped cooperatively at a superstep boundary because RunControl.request_drain() was called (e.g., in response t

    Class

    GraphRecursionError

    Raised when the graph has exhausted the maximum number of steps.

    This prevents infinite loops. To increase the maximum number of steps, run your graph with a config specifying a higher `recursion_lim

    Class

    InvalidUpdateError

    Raised when attempting to update a channel with an invalid set of updates.

    Troubleshooting guides:

    • [INVALID_CONCURRENT_GRAPH_UPDATE](https://docs.langchain.com/oss/python/langgraph/INVALID_CONCU
    Class

    GraphInterrupt

    Raised when a subgraph is interrupted, suppressed by the root graph. Never raised directly, or surfaced to the user.

    Class

    ParentCommand

    Class

    EmptyInputError

    Raised when graph receives an empty input.

    Class

    TaskNotFound

    Raised when the executor is unable to find a task (for distributed mode).

    Class

    NodeError

    Failure context passed to a node-level error handler.

    Inject by adding a parameter typed NodeError to a handler registered via StateGraph.add_node(..., error_handler=...):

    def handler(
    
    Class

    NodeCancelledError

    Raised when a node body raises asyncio.CancelledError itself.

    asyncio.CancelledError is a BaseException and the pregel runner treats cancelled task futures as silent tear-down (e.g. when

    Class

    NodeTimeoutError

    Raised when a node invocation exceeds one of its configured timeouts.

    Does not inherit from the built-in TimeoutError (a subclass of OSError) so that the default RetryPolicy treats it as re

    Class

    UIMessage

    A message type for UI updates in LangGraph.

    This TypedDict represents a UI message that can be sent to update the UI state. It contains information about the UI component to render and its properties

    Class

    RemoveUIMessage

    A message type for removing UI components in LangGraph.

    This TypedDict represents a message that can be sent to remove a UI component from the current state.

    Class

    StateNodeSpec

    Class

    MessagesState

    Class

    BranchSpec

    Class

    StateGraph

    A graph whose nodes communicate by reading and writing to a shared state.

    The signature of each node is State -> Partial<State>.

    Each state key can optionally be annotated with a reducer function

    Class

    CompiledStateGraph

    Class

    AsyncQueue

    Async unbounded FIFO queue with a wait() method.

    Subclassed from asyncio.Queue, adding a wait() method.

    Class

    Semaphore

    Semaphore subclass with a wait() method.

    Class

    SyncQueue

    Unbounded FIFO queue with a wait() method. Adapted from pure Python implementation of queue.SimpleQueue.

    Class

    PregelScratchpad

    Class

    TypedDictLikeV1

    Protocol to represent types that behave like TypedDicts

    Version 1: using ClassVar for keys.

    Class

    TypedDictLikeV2

    Protocol to represent types that behave like TypedDicts

    Version 2: not using ClassVar for keys.

    Class

    DataclassLike

    Protocol to represent types that behave like dataclasses.

    Inspired by the private _DataclassT from dataclasses that uses a similar protocol as a bound.

    Class

    DeprecatedKwargs

    TypedDict to use for extra keyword arguments, enabling type checking warnings for deprecated arguments.

    Class

    StrEnum

    A string enum.

    Class

    RunnableCallable

    A much simpler version of RunnableLambda that requires sync and async functions.

    Class

    RunnableSeq

    Sequence of Runnable, where the output of each is the input of the next.

    RunnableSeq is a simpler version of RunnableSequence that is internal to LangGraph.

    Class

    ReplayState

    Tracks which subgraphs have already loaded their pre-replay checkpoint.

    During a parent replay, each subgraph's first invocation should restore the checkpoint from before the replay point. Subsequent

    Class

    StreamMux

    Central event dispatcher for the streaming infrastructure.

    Owns the main event log and routes events through a transformer pipeline. StreamChannels with a name discovered in transformer projections a

    Class

    ValuesTransformer

    Capture values events as a drainable stream of state snapshots.

    Provides the run.values projection. run.output, run.interrupted and run.interrupts are tracked directly by the run stream and d

    Class

    CustomTransformer

    Capture custom events as a drainable stream of arbitrary payloads.

    Nodes emit custom data via get_stream_writer(). This transformer surfaces those events on run.custom as a StreamChannel[Any],

    Class

    UpdatesTransformer

    Capture updates events as a drainable stream of node outputs.

    Surfaces stream_mode="updates" data on run.updates as a StreamChannel[dict[str, Any]]. Each item is a dict mapping a node (or task)

    Class

    MessagesTransformer

    Capture messages events as ChatModelStream objects.

    The messages projection yields one ChatModelStream (or AsyncChatModelStream) per LLM call. Consumers iterate run.messages to get stream handl

    Class

    LifecyclePayload

    Payload of a lifecycle event surfaced on the lifecycle channel.

    Auto-forwarded as lifecycle protocol events (no custom: prefix because LifecycleTransformer is a native transformer) so remote

    Class

    LifecycleTransformer

    Surface subgraph lifecycle as lifecycle protocol events.

    Pushes LifecyclePayload to a StreamChannel named lifecycle. The channel is auto-forwarded by the mux so payloads land in the main even

    Class

    SubgraphTransformer

    Discover subgraph invocations as in-process navigation handles.

    Per discovered direct-child subgraph, builds a SubgraphRunStream (or AsyncSubgraphRunStream) wrapping a child mini-mux scoped to th

    Class

    CheckpointsTransformer

    Capture checkpoint events as a drainable stream.

    Surfaces stream_mode="checkpoints" data on run.checkpoints as a StreamChannel[dict[str, Any]]. Each item is in the same format as returned by `g

    Class

    DebugTransformer

    Capture debug events as a drainable stream.

    Surfaces stream_mode="debug" data on run.debug as a StreamChannel[dict[str, Any]]. Each item is a debug event with step-level detail (checkpoint snap

    Class

    TasksTransformer

    Capture raw task events as a drainable stream.

    Surfaces stream_mode="tasks" data on run.tasks as a StreamChannel[dict[str, Any]]. Each item is a task payload (start or result).

    `LifecycleTrans

    Class

    ProtocolEvent

    A protocol event emitted by the streaming infrastructure.

    Wraps a raw stream part (values, messages, custom, etc.) in a uniform envelope with a monotonic sequence number assigned by the root StreamMu

    Class

    StreamTransformer

    Extension point for custom stream projections.

    Transformers observe protocol events flowing through the StreamMux and build typed derived projections (StreamChannels, promises, etc.).

    Set `_native =

    Class

    GraphRunStream

    Sync run stream with caller-driven pumping.

    The caller's iteration on any projection (values, messages, raw events, or output) drives the graph forward. No background thread is used — the calle

    Class

    AsyncGraphRunStream

    Async run stream with caller-driven pumping.

    Async iteration on any projection drives the graph forward — there is no background task. Concurrent consumers share a single-flight pump via an `asyncio.

    Class

    SubgraphRunStream

    Sync handle for a discovered subgraph (extends GraphRunStream).

    Class

    AsyncSubgraphRunStream

    Async handle for a discovered subgraph (extends AsyncGraphRunStream).

    Class

    StreamChannel

    Single-consumer drainable queue for streaming events, with optional protocol auto-forwarding.

    When constructed with a name, the StreamMux auto-wires every push() to also inject a ProtocolEvent

    Class

    NamedBarrierValue

    A channel that waits until all named values are received before making the value available.

    Class

    NamedBarrierValueAfterFinish

    A channel that waits until all named values are received before making the value ready to be made available. It is only made available after finish() is called.

    Class

    AnyValue

    Stores the last value received, assumes that if multiple values are received, they are all equal.

    Class

    EphemeralValue

    Stores the value received in the step immediately preceding, clears after.

    Class

    LastValue

    Stores the last value received, can receive at most one value per step.

    Class

    LastValueAfterFinish

    Stores the last value received, but only made available after finish(). Once made available, clears the value.

    Class

    Topic

    A configurable PubSub Topic.

    Class

    UntrackedValue

    Stores the last value received, never checkpointed.

    Class

    DeltaChannel

    Reducer channel that stores only a sentinel in checkpoint blobs and reconstructs state by replaying ancestor writes through the reducer.

    Beta

    DeltaChannel is in beta. The API and

    Class

    BinaryOperatorAggregate

    Stores the result of applying a binary operator to the current value and each new value.

    import operator
    
    total = Channels.BinaryOperatorAggregate(int, operator.add)
    Class

    BaseChannel

    Base class for all channels.

    Class

    entrypoint

    Define a LangGraph workflow using the entrypoint decorator.

    Function signature

    The decorated function must accept a single parameter, which serves as the input to the function. This input

    Class

    final

    A primitive that can be returned from an entrypoint.

    This primitive allows to save a value to the checkpointer distinct from the return value from the entrypoint.

    Class

    RemoteException

    Exception raised when an error occurs in the remote graph.

    Class

    RemoteGraph

    The RemoteGraph class is a client implementation for calling remote APIs that implement the LangGraph Server API specification.

    For example, the RemoteGraph class can be used to call APIs from de

    Class

    StreamToolCallHandler

    Callback handler that emits tool-call lifecycle events on the stream.

    Fires on LangChain's on_tool_* callbacks and pushes to the tools stream mode. Emits tool-started / tool-output-delta / `t

    Class

    NodeBuilder

    Class

    Pregel

    Pregel manages the runtime behavior for LangGraph applications.

    Overview

    Pregel combines actors and channels into a single application. **Acto

    Class

    FuturesDict

    Class

    PregelRunner

    Responsible for executing a set of Pregel tasks concurrently, committing their writes, yielding control to caller when there is output to emit, and interrupting other tasks if appropriate.

    Class

    PregelLoop

    Class

    SyncPregelLoop

    Class

    AsyncPregelLoop

    Class

    Edge

    Class

    TriggerEdge

    Class

    StreamMessagesHandler

    A callback handler that implements stream_mode=messages.

    Collects messages from: (1) chat model stream events; and (2) node outputs.

    Class

    StreamMessagesHandlerV2

    v2 variant of StreamMessagesHandler.

    Declaring _V2StreamingCallbackHandler as a base flips BaseChatModel.invoke to route through _stream_chat_model_events (firing on_stream_event) instead o

    Class

    ChannelWriteEntry

    Class

    ChannelWriteTupleEntry

    Class

    ChannelWrite

    Implements the logic for sending writes to CONFIG_KEY_SEND. Can be used as a runnable or as a static method to call imperatively.

    Class

    PregelProtocol

    Class

    StreamProtocol

    Class

    ChannelRead

    Implements the logic for reading state from CONFIG_KEY_READ. Usable both as a runnable as well as a static method to call imperatively.

    Class

    PregelNode

    A node in a Pregel graph. This won't be invoked as a runnable by the graph itself, but instead acts as a container for the components necessary to make a PregelExecutableTask for a node.

    Class

    Submit

    Class

    BackgroundExecutor

    A context manager that runs sync tasks in the background. Uses a thread pool executor to delegate tasks to separate threads. On exit,

    • cancels any (not yet started) tasks with `cancel_on_exit=Tru
    Class

    AsyncBackgroundExecutor

    A context manager that runs async tasks in the background. Uses the current event loop to delegate tasks to asyncio tasks. On exit,

    • cancels any tasks with __cancel_on_exit__=True
    • waits for all t
    Class

    WritesProtocol

    Protocol for objects containing writes to be applied to checkpoint. Implemented by PregelTaskWrites and PregelExecutableTask.

    Class

    PregelTaskWrites

    Simplest implementation of WritesProtocol, for usage with writes that don't originate from a runnable task, eg. graph input, update_state, etc.

    Class

    Call

    Class

    LazyAtomicCounter

    Class

    SyncAsyncFuture

    Class

    IsLastStepManager

    Class

    RemainingStepsManager

    Class

    ManagedValue

    Class

    NodeInterrupt

    deprecated

    Raised by a node to interrupt execution.

    Class

    MessageGraph

    deprecated

    A StateGraph where every node receives a list of messages as input and returns one or more messages as output.

    MessageGraph is a subclass of StateGraph whose entire state is a single, append-only* li

    Functions

    Function

    get_sync_graph_callback_manager_for_config

    Build a sync graph lifecycle callback manager from a runnable config.

    This helper filters config["callbacks"] down to handlers that inherit from GraphCallbackHandler and binds the provided `run_i

    Function

    get_async_graph_callback_manager_for_config

    Build an async graph lifecycle callback manager from a runnable config.

    This helper filters config["callbacks"] down to handlers that inherit from GraphCallbackHandler and binds the provided `run

    Function

    ensure_valid_checkpointer

    Function

    omit_payload

    TracePolicy helper that records an empty payload, dropping the value entirely.

    Use as process_inputs and/or process_outputs on a TracePolicy to keep a node's span and its timing while omittin

    Function

    interrupt

    Interrupt the graph with a resumable exception from within a node.

    The interrupt function enables human-in-the-loop workflows by pausing graph execution and surfacing a value to the client. This va

    Function

    get_runtime

    Get the runtime for the current graph run.

    Function

    get_config

    Function

    get_store

    Access LangGraph store from inside a graph node or entrypoint task at runtime.

    Can be called from inside any StateGraph node or functional API [task][langgraph.func.

    Function

    get_stream_writer

    Access LangGraph StreamWriter from inside a graph node or entrypoint task at runtime.

    Can be called from inside any StateGraph node o

    Function

    create_error_message

    Function

    push_ui_message

    Push a new UI message to update the UI state.

    This function creates and sends a UI message that will be rendered in the UI. It also updates the graph state with the new UI message.

    Function

    delete_ui_message

    Delete a UI message by ID from the UI state.

    This function creates and sends a message to remove a UI component from the current state. It also updates the graph state to remove the UI message.

    Function

    ui_message_reducer

    Merge two lists of UI messages, supporting removing UI messages.

    This function combines two lists of UI messages, handling both regular UI messages and remove-ui messages. When a remove-ui messag

    Function

    add_messages

    Merges two lists of messages, updating existing messages by ID.

    By default, this ensures the state is "append-only", unless the new message has the same ID as an existing message.

    Function

    push_message

    Write a message manually to the messages / messages-tuple stream mode.

    Will automatically write to the channel specified in the state_key unless state_key is None.

    Function

    coerce_timeout_policy

    Normalize a timeout value to positive-second policy fields.

    Function

    sync_timeout_unsupported

    Build the canonical error for using timeout with a sync target.

    Function

    default_cache_key

    Default cache key function that uses the arguments and keyword arguments to generate a hashable key.

    Function

    chain_future

    Function

    run_coroutine_threadsafe

    Submit a coroutine object to a given event loop.

    Return an asyncio.Future to access the result.

    Function

    get_fields

    Get the field names of a Pydantic model.

    Function

    create_model

    Create a pydantic model with the given field definitions.

    Function

    is_supported_by_pydantic

    Check if a given "complex" type is supported by pydantic.

    This will return False for primitive types like int, str, etc.

    The check is meant for container types like dataclasses, TypedDicts, etc.

    Function

    apply_checkpointer_allowlist

    Function

    curated_core_allowlist

    Function

    build_serde_allowlist

    Function

    collect_allowlist_from_schemas

    Function

    default_retry_on

    Function

    recast_checkpoint_ns

    Remove task IDs from checkpoint namespace.

    Function

    patch_configurable

    Function

    patch_checkpoint_map

    Function

    merge_configs

    Merge multiple configs into one.

    Function

    patch_config

    Patch a config with new values.

    Function

    get_callback_manager_for_config

    Get a callback manager for a config.

    Function

    get_async_callback_manager_for_config

    Get an async callback manager for a config.

    Function

    ensure_config

    Return a config with all keys, merging any provided configs.

    Function

    filter_to_user_tags

    Drop langgraph's internal seq:step:* bookkeeping tags.

    seq:step:N tags are added internally to mark sequence steps; everything else (user-supplied tags and any other framework tags) is kept. Retu

    Function

    get_field_default

    Determine the default value for a field in a state schema.

    Function

    get_enhanced_type_hints

    Attempt to extract default values and descriptions from provided type, used for config schema.

    Function

    get_update_as_tuples

    Get Pydantic state update as a list of (key, value) tuples.

    Function

    get_cached_annotated_keys

    Return cached annotated keys for a Python class.

    Function

    set_config_context

    Set the child Runnable config + tracing context.

    Function

    create_task_in_config_context

    Create an asyncio.Task that inherits config as the child runnable context.

    asyncio.create_task snapshots the current contextvars onto the new task, so calling create_task while the config conte

    Function

    is_async_callable

    Check if a function is async.

    Function

    is_async_generator

    Check if a function is an async generator.

    Function

    coerce_to_runnable

    Coerce a runnable-like object into a Runnable.

    Function

    convert_to_protocol_event

    Convert a v2 StreamPart to a ProtocolEvent.

    Function

    transformer_requires_async

    Return True if the transformer needs a running event loop.

    A transformer requires async if it explicitly opts in (requires_async = True) or overrides any of the async-lane methods (aprocess, `afi

    Function

    task

    Define a LangGraph task using the task decorator.

    Requires python 3.11 or higher for async functions

    The task decorator supports both sync and async functions. To use async

    Function

    DuplexStream

    Function

    draw_graph

    Get the graph for this Pregel instance.

    Function

    add_edge

    Add an edge to the graph.

    Function

    ensure_message_ids

    Coerce message-like write values to typed BaseMessages with stable IDs.

    Called in put_writes() before DeltaChannel writes are submitted to the checkpointer. Without this the checkpoint may store raw

    Function

    read_channel

    Function

    read_channels

    Function

    map_command

    Map input chunk to a sequence of pending writes in the form (channel, value).

    Function

    map_input

    Map input chunk to a sequence of pending writes in the form (channel, value).

    Function

    map_output_values

    Map pending writes (a sequence of tuples (channel, value)) to output chunk.

    Function

    map_output_updates

    Map pending writes (a sequence of tuples (channel, value)) to output chunk.

    Function

    map_debug_tasks

    Produce "task" events for stream_mode=debug.

    Function

    is_multiple_channel_write

    Return True if the payload already wraps multiple writes from the same channel.

    Function

    map_task_result_writes

    Folds task writes into a result dict and aggregates multiple writes to the same channel.

    If the channel contains a single write, we record the write in the result dict as {channel: write} If the ch

    Function

    map_debug_task_results

    Produce "task_result" events for stream_mode=debug.

    Function

    rm_pregel_keys

    Remove pregel-specific keys from the config.

    Function

    map_debug_checkpoint

    Produce "checkpoint" events for stream_mode=debug.

    Function

    tasks_w_writes

    Apply writes / subgraph states to tasks to be returned in a StateSnapshot.

    Function

    get_colored_text

    Get colored text.

    Function

    get_bolded_text

    Get bolded text.

    Function

    empty_checkpoint

    Function

    exit_delta_task_id

    Synthetic task id for exit-mode DeltaChannel writes.

    Embeds the superstep in the first UUID group so ORDER BY task_id, idx preserves chronological order while remaining a valid RFC UUID (required b

    Function

    delta_channels_to_snapshot

    Return the set of DeltaChannel names that should snapshot now.

    A channel snapshots when EITHER its accumulated update count reaches snapshot_frequency OR the total supersteps since its last snapsho

    Function

    get_updated_channels_from_tasks

    Channel names written by an update_state superstep (excluding PUSH).

    Function

    get_delta_channels_from_all_channels

    DeltaChannels to snapshot on the first update_state of a fresh thread.

    Function

    create_metadata_for_update_state_api

    Advance counters_since_delta_snapshot for update_state on a non-fresh thread.

    Mirrors the per-superstep counter bump in _loop._put_checkpoint.

    Function

    create_checkpoint_plan_for_update_state_api

    Return (channels_to_snapshot, metadata) for an update_state head.

    Function

    create_checkpoint

    Build a new Checkpoint from the previous one and live channel state.

    For each name in channels_to_snapshot, a _DeltaSnapshot(value) blob is written into channel_values[k]. Other delta channels

    Function

    channels_from_checkpoint

    Hydrate channels from a checkpoint.

    For most channels, spec.from_checkpoint(checkpoint["channel_values"][k]) is sufficient. DeltaChannel is the exception: when the channel is absent from `channel

    Function

    achannels_from_checkpoint

    Async version of channels_from_checkpoint. See docstring there.

    Function

    copy_checkpoint

    Function

    run_with_retry

    Run a task with retries.

    Function

    arun_with_retry

    Run a task asynchronously with retries.

    Function

    get_new_channel_versions

    Get subset of current_versions that are newer than previous_versions.

    Function

    find_subgraph_pregel

    Function

    validate_timeout_supported

    Function

    get_function_nonlocals

    Get the values a function reaches from outside its own scope.

    Function

    is_xxh3_128_hexdigest

    Check if the given string matches the format of xxh3_128_hexdigest.

    Function

    validate_graph

    Function

    validate_keys

    Function

    gated

    A coroutine that waits for a semaphore before running another coroutine.

    Function

    next_tick

    A function that yields control to other threads before running another function.

    Function

    should_interrupt

    Check if the graph should be interrupted based on current state.

    Function

    local_read

    Function injected under CONFIG_KEY_READ in task config, to read current state. Used by conditional edges to read a copy of the state with reflecting the writes from that node only.

    Function

    increment

    Default channel versioning function, increments the current int version.

    Function

    apply_writes

    Apply writes from a set of tasks (usually the tasks from a Pregel step) to the checkpoint and channels, and return managed values writes to be applied externally.

    Function

    prepare_next_tasks

    Prepare the set of tasks that will make up the next Pregel step.

    Function

    prepare_single_task

    Prepares a single task for the next Pregel step, given a task path, which uniquely identifies a PUSH or PULL task within the graph.

    Function

    prepare_push_task_functional

    Prepare a push task with an attached caller. Used for the functional API.

    Function

    prepare_push_task_send

    Function

    prepare_node_error_handler_task

    Prepare an immediate node-level error handler task for a failed task.

    Function

    checkpoint_null_version

    Get the null version for the checkpoint, if available.

    Function

    task_path_str

    Generate a string representation of the task path.

    Function

    sanitize_untracked_values_in_send

    Pop any values belonging to UntrackedValue channels in Send.arg for safe checkpointing.

    Send is often called with state to be passed to the dest node, which may contain UntrackedValues at the top lev

    Function

    identifier

    Return the module and name of an object.

    Function

    get_runnable_for_entrypoint

    Function

    get_runnable_for_task

    Function

    call

    Function

    is_managed_value

    Modules

    Types

    Module

    langgraph

    Module

    version

    Exports package version.

    Module

    callbacks

    Graph lifecycle callback interfaces and event payloads.

    This module defines the public callback surface for observing LangGraph-specific lifecycle transitions such as interrupt and resume.

    Module

    warnings

    LangGraph specific warnings.

    Module

    types

    Module

    runtime

    Module

    config

    Module

    typing

    Module

    errors

    Module

    constants

    Module

    graph

    Module

    ui

    Module

    message

    Module

    state

    Module

    utils

    Legacy utilities module, to be removed in v1.

    Module

    runnable

    Backwards compat imports for runnable utilities, to be removed in v1.

    Module

    config

    Backwards compat imports for config utilities, to be removed in v1.

    Module

    stream

    Streaming infrastructure for LangGraph.

    Compile a graph with transformers=[...] and call graph.stream_events(version="v3") / graph.astream_events(version="v3") to drive a transformer pipeline t

    Module

    transformers

    Module

    run_stream

    Module

    stream_channel

    Module

    channels

    Module

    named_barrier_value

    Module

    any_value

    Module

    ephemeral_value

    Module

    last_value

    Module

    topic

    Module

    untracked_value

    Module

    delta

    Module

    binop

    Module

    base

    Module

    func

    Module

    pregel

    Module

    remote

    Module

    main

    Module

    types

    Re-export types moved to langgraph.types

    Module

    protocol

    Module

    debug

    Module

    managed

    Module

    is_last_step

    Module

    base

    Type

    GraphLifecycleStatus

    Allowed lifecycle statuses reported in graph lifecycle callback events.

    Type

    GraphLifecycleEvent

    Union of all public graph lifecycle callback event payloads.

    Use this alias when a callback or helper can receive either interrupt or resume lifecycle events.

    Type

    GraphCallbacks

    Type

    Checkpointer

    Type of the checkpointer to use for a subgraph.

    • True enables persistent checkpointing for this subgraph.
    • False disables checkpointing, even if the parent graph has a checkpointer.
    • None in
    Type

    AnyUIMessage

    Type

    StateNode

    Type

    Messages

    Type

    AnyFuture

    Type

    StateLike

    Type alias for state-like types.

    It can either be a TypedDict, dataclass, or Pydantic BaseModel. Note: we cannot use either TypedDict or dataclass directly due to limitations in type checki

    Type

    RunnableLike