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-coretracersroot_listenersAsyncRootListenersTracer
    Class●Since v0.2

    AsyncRootListenersTracer

    Async tracer that calls listeners on run start, end, and error.

    Copy
    AsyncRootListenersTracer(
      self,
      *,
      config: RunnableConfig,
      on_start: AsyncListener | None,
      on_end: AsyncListener | None,
      on_error: AsyncListener | None
    )

    Bases

    AsyncBaseTracer

    Parameters

    NameTypeDescription
    config*RunnableConfig

    The runnable config.

    on_start*AsyncListener | None

    The listener to call on run start.

    on_end*AsyncListener | None

    The listener to call on run end.

    on_error*AsyncListener | None

    The listener to call on run error

    Constructors

    constructor
    __init__
    NameType
    configRunnableConfig
    on_startAsyncListener | None
    on_endAsyncListener | None
    on_errorAsyncListener | None

    Attributes

    attribute
    log_missing_parent: bool

    Whether to log a warning if the parent is missing.

    attribute
    config: config
    attribute
    root_id: UUID | None

    Inherited fromAsyncBaseTracer

    Methods

    Mon_chat_model_startMon_llm_startMon_llm_new_tokenMon_retryMon_llm_end
    —

    End a trace for an LLM or chat model run.

    Mon_llm_errorMon_chain_startMon_chain_endMon_chain_errorMon_tool_startMon_tool_endMon_tool_errorMon_retriever_startMon_retriever_errorMon_retriever_end

    Inherited fromAsyncCallbackHandler

    Methods

    Mon_llm_start
    —

    Run when the model starts running.

    Mon_chat_model_start
    —

    Run when a chat model starts running.

    Mon_llm_new_token
    —

    Run on new output token. Only available when streaming is enabled.

    Mon_llm_end
    —

    Run when the model ends running.

    Mon_llm_error
    —

    Run when LLM errors.

    Mon_chain_start
    —

    Run when a chain starts running.

    Mon_chain_end
    —

    Run when a chain ends running.

    Mon_chain_error
    —

    Run when chain errors.

    Mon_tool_start
    —

    Run when the tool starts running.

    Mon_tool_end
    —

    Run when the tool ends running.

    Mon_tool_error
    —

    Run when tool errors.

    Mon_text
    —

    Run on an arbitrary text.

    Mon_retry
    —

    Run on a retry event.

    Mon_agent_action
    —

    Run on agent action.

    Mon_agent_finish
    —

    Run on the agent end.

    Mon_retriever_start
    —

    Run on the retriever start.

    Mon_retriever_end
    —

    Run on the retriever end.

    Mon_retriever_error
    —

    Run on retriever error.

    Mon_custom_event
    —

    Override to define a handler for custom events.

    Inherited fromBaseCallbackHandler

    Attributes

    Araise_error: bool
    —

    Whether to raise an error if an exception occurs.

    Arun_inline: bool
    —

    Whether to run the callback inline.

    Aignore_llm: bool
    —

    Whether to ignore LLM callbacks.

    Aignore_retry: bool
    —

    Whether to ignore retry callbacks.

    Aignore_chain: bool
    —

    Whether to ignore chain callbacks.

    Aignore_agent: bool
    —

    Whether to ignore agent callbacks.

    Aignore_retriever: bool
    —

    Whether to ignore retriever callbacks.

    Aignore_chat_model: bool
    —

    Whether to ignore chat model callbacks.

    Aignore_custom_event: bool
    —

    Ignore custom event.

    Inherited fromLLMManagerMixin

    Methods

    Mon_llm_new_token
    —

    Run on new output token.

    Mon_llm_end
    —

    Run when LLM ends running.

    Mon_llm_error
    —

    Run when LLM errors.

    Inherited fromChainManagerMixin

    Methods

    Mon_chain_end
    —

    Run when chain ends running.

    Mon_chain_error
    —

    Run when chain errors.

    Mon_agent_action
    —

    Run on agent action.

    Mon_agent_finish
    —

    Run on the agent end.

    Inherited fromToolManagerMixin

    Methods

    Mon_tool_end
    —

    Run when the tool ends running.

    Mon_tool_error
    —

    Run when tool errors.

    Inherited fromRetrieverManagerMixin

    Methods

    Mon_retriever_error
    —

    Run when Retriever errors.

    Mon_retriever_end
    —

    Run when Retriever ends running.

    Inherited fromCallbackManagerMixin

    Methods

    Mon_llm_start
    —

    Run when LLM starts running.

    Mon_chat_model_start
    —

    Run when a chat model starts running.

    Mon_retriever_start
    —

    Run when the Retriever starts running.

    Mon_chain_start
    —

    Run when a chain starts running.

    Mon_tool_start
    —

    Run when the tool starts running.

    Inherited fromRunManagerMixin

    Methods

    Mon_text
    —

    Run on an arbitrary text.

    Mon_retry
    —

    Run on a retry event.

    Mon_custom_event
    —

    Override to define a handler for a custom event.

    View source on GitHub