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-corecallbacksbaseRunManagerMixinon_custom_event
    Method●Since v0.2

    on_custom_event

    Override to define a handler for a custom event.

    Copy
    on_custom_event(
      self,
      name: str,
      data: Any,
      *,
      run_id: UUID,
      tags: list[str] | None = None,
      metadata: dict[str, Any] | None = None,
      **kwargs: Any = {}
    ) -> Any

    Parameters

    NameTypeDescription
    name*str

    The name of the custom event.

    data*Any

    The data for the custom event.

    Format will match the format specified by the user.

    run_id*UUID

    The ID of the run.

    tagslist[str] | None
    Default:None

    The tags associated with the custom event (includes inherited tags).

    metadatadict[str, Any] | None
    Default:None

    The metadata associated with the custom event (includes inherited metadata).

    View source on GitHub