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
    Pythonlanggraphpregelprotocol
    Module●Since v0.2

    protocol

    Attributes

    Classes

    View source on GitHub
    attribute
    All: Literal['*']
    attribute
    StreamMode: Literal['values', 'updates', 'checkpoints', 'tasks', 'debug', 'messages', 'custom']
    attribute
    StreamPart
    attribute
    ContextT
    attribute
    InputT
    attribute
    OutputT
    attribute
    StateT
    attribute
    StreamChunk: tuple[tuple[str, ...], str, Any]
    class
    Command
    class
    GraphOutput
    class
    StateSnapshot
    class
    StateUpdate
    class
    PregelProtocol
    class
    StreamProtocol

    Special value to indicate that graph should interrupt on all nodes.

    How the stream method should emit outputs.

    • "values": Emit all values in the state after each step, including interrupts. When used with functional API, values are emitted once at the end of the workflow.
    • "updates": Emit only the node or task names and updates returned by the nodes or tasks after each step. If multiple updates are made in the same step (e.g. multiple nodes are run) then those updates are emitted separately.
    • "custom": Emit custom data using from inside nodes or tasks using StreamWriter.
    • "messages": Emit LLM messages token-by-token together with metadata for any LLM invocations inside nodes or tasks.
    • "checkpoints": Emit an event when a checkpoint is created, in the same format as returned by get_state().
    • "tasks": Emit events when tasks start and finish, including their results and errors.
    • "debug": Emit "checkpoints" and "tasks" events for debugging purposes.

    Type variable used to represent graph run scoped context.

    Defaults to None.

    Type variable used to represent the input to a StateGraph.

    Defaults to StateT.

    Type variable used to represent the output of a StateGraph.

    Defaults to StateT.

    Type variable used to represent the state in a graph.

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

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

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

    A discriminated union of all v2 stream part types.

    Use part["type"] to narrow the type:

    async for part in graph.astream(input, version="v2"):
        if part["type"] == "values":
            part["data"]  # OutputT — full state (pydantic/dataclass/dict)
        elif part["type"] == "messages":
            part["data"]  # tuple[BaseMessage, dict] — (message, metadata)
        elif part["type"] == "custom":
            part["data"]  # Any — user-defined