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-corecallbacksbaseCallbackManagerMixin
    Class●Since v0.1

    CallbackManagerMixin

    Mixin for callback manager.

    Copy
    CallbackManagerMixin()

    Methods

    method
    on_llm_start

    Run when LLM starts running.

    Warning

    This method is called for non-chat models (regular text completion LLMs). If you're implementing a handler for a chat model, you should use on_chat_model_start instead.

    method
    on_chat_model_start

    Run when a chat model starts running.

    Warning

    This method is called for chat models. If you're implementing a handler for a non-chat model, you should use on_llm_start instead.

    Note

    When overriding this method, the signature must include the two required positional arguments serialized and messages. Avoid using *args in your override — doing so causes an IndexError in the fallback path when the callback system converts messages to prompt strings for on_llm_start. Always declare the signature explicitly:

    .. code-block:: python

    def on_chat_model_start(
        self,
        serialized: dict[str, Any],
        messages: list[list[BaseMessage]],
        **kwargs: Any,
    ) -> None:
        raise NotImplementedError  # triggers fallback to on_llm_start
    
    method
    on_retriever_start

    Run when the Retriever starts running.

    method
    on_chain_start

    Run when a chain starts running.

    method
    on_tool_start

    Run when the tool starts running.

    View source on GitHub