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
    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
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraphgraphuipush_ui_message
    Functionā—Since v0.3

    push_ui_message

    Copy
    push_ui_message(
      name: str,
      props: dict[str, Any],
      *,
      id:
    View source on GitHub
    str
    |
    None
    =
    None
    ,
    metadata
    :
    dict
    [
    str
    ,
    Any
    ]
    |
    None
    =
    None
    ,
    message
    :
    AnyMessage
    |
    None
    =
    None
    ,
    state_key
    :
    str
    |
    None
    =
    'ui'
    ,
    merge
    :
    bool
    =
    False
    )
    ->
    UIMessage

    Parameters

    NameTypeDescription
    name*str

    Name of the UI component to render.

    props*dict[str, Any]

    Properties to pass to the UI component.

    idstr | None
    Default:None
    metadatadict[str, Any] | None
    Default:None
    messageAnyMessage | None
    Default:None
    state_keystr | None
    Default:'ui'
    mergebool
    Default:False

    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.

    Example:

    push_ui_message(
        name="component-name",
        props={"content": "Hello world"},
    )

    Optional unique identifier for the UI message. If not provided, a random UUID will be generated.

    Optional additional metadata about the UI message.

    Optional message object to associate with the UI message.

    Key in the graph state where the UI messages are stored.

    Whether to merge props with existing UI message (True) or replace them (False).