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

    Chat LangChain

    What can I help with?

    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
    PythonlanggraphgraphmessageMessageGraph
    Classโ—Since v1.2Deprecated

    MessageGraph

    Copy
    MessageGraph(
        self,
    )

    Bases

    StateGraph

    Constructors

    Inherited fromStateGraph

    Attributes

    Aedges: set[tuple[str, str]]Anodes: dict[str, StateNodeSpec[Any, ContextT]]Abranches: defaultdict[str, dict[str, BranchSpec]]Achannels: dict[str, BaseChannel]
    View source on GitHub
    A
    managed
    : dict[str, ManagedValueSpec]
    Aschemas: dict[type[Any], dict[str, BaseChannel | ManagedValueSpec]]
    Awaiting_edges: set[tuple[tuple[str, ...], str]]
    Acompiled: bool
    Astate_schema: type[StateT]
    Acontext_schema: type[ContextT] | None
    Ainput_schema: type[InputT]
    Aoutput_schema: type[OutputT]

    Methods

    Mset_node_defaults
    โ€”

    Set default node policies that apply to every node in this graph.

    Madd_node
    โ€”

    Add a new node to the StateGraph.

    Madd_edge
    โ€”

    Add a directed edge from the start node (or list of start nodes) to the end node.

    Madd_conditional_edges
    โ€”

    Add a conditional edge from the starting node to any number of destination nodes.

    Madd_sequence
    โ€”

    Add a sequence of nodes that will be executed in the provided order.

    Mset_entry_point
    โ€”

    Specifies the first node to be called in the graph.

    Mset_conditional_entry_point
    โ€”

    Sets a conditional entry point in the graph.

    Mset_finish_point
    โ€”

    Marks a node as a finish point of the graph.

    MvalidateMcompile
    โ€”

    Compiles the StateGraph into a CompiledStateGraph object.

    constructor
    __init__

    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* list of messages. Each node in a MessageGraph takes a list of messages as input and returns zero or more messages as output. The add_messages function is used to merge the output messages from each node into the existing list of messages in the graph's state.