LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-corecallbacksbaseAsyncCallbackHandleron_stream_event
    Methodā—Since v1.3

    on_stream_event

    Copy
    on_stream_event(
      self,
      event: MessagesData,
      *,
      run_id: UUID,
      parent_run_id: UUID 
    View source on GitHub
    |
    None
    =
    None
    ,
    tags
    :
    list
    [
    str
    ]
    |
    None
    =
    None
    ,
    **
    kwargs
    :
    Any
    =
    {
    }
    )
    ->
    None

    Parameters

    NameTypeDescription
    event*MessagesData

    The protocol event.

    run_id*UUID

    The ID of the current run.

    parent_run_idUUID | None
    Default:None

    The ID of the parent run.

    tagslist[str] | None
    Default:None
    **kwargsAny
    Default:{}

    Run on each protocol event produced by astream_events(version="v3").

    See :meth:LLMManagerMixin.on_stream_event for the full contract. Fires once per MessagesData event at event granularity, uniformly across native and compat-bridge providers, and is purely additive to the existing on_chat_model_start / on_llm_end / on_llm_error callbacks.

    The tags.

    Additional keyword arguments.