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-corecallbacksmanager
    Module●Since v0.1

    manager

    Run managers.

    Attributes

    attribute
    tracing_v2_callback_var: ContextVar[LangChainTracer | None]
    attribute
    Run: RunTree
    attribute
    logger
    attribute
    Func
    attribute
    T

    Functions

    function
    get_debug

    Get the value of the debug global setting.

    function
    get_buffer_string

    Convert a sequence of messages to strings and concatenate them into one string.

    function
    env_var_is_set

    Check if an environment variable is set.

    function
    uuid7

    Generate a UUID from a Unix timestamp in nanoseconds and random bits.

    UUIDv7 objects feature monotonicity within a millisecond.

    function
    trace_as_chain_group

    Get a callback manager for a chain group in a context manager.

    Useful for grouping different calls together as a single run even if they aren't composed in a single chain.

    function
    atrace_as_chain_group

    Get an async callback manager for a chain group in a context manager.

    Useful for grouping different async calls together as a single run even if they aren't composed in a single chain.

    function
    shielded

    Makes so an awaitable method is always shielded from cancellation.

    function
    handle_event

    Generic event handler for CallbackManager.

    function
    ahandle_event

    Async generic event handler for AsyncCallbackManager.

    function
    adispatch_custom_event

    Dispatch an adhoc event to the handlers.

    function
    dispatch_custom_event

    Dispatch an adhoc event.

    Classes

    class
    BaseCallbackHandler

    Base callback handler.

    class
    BaseCallbackManager

    Base callback manager.

    class
    ChainManagerMixin

    Mixin for chain callbacks.

    class
    LLMManagerMixin

    Mixin for LLM callbacks.

    class
    RetrieverManagerMixin

    Mixin for Retriever callbacks.

    class
    RunManagerMixin

    Mixin for run manager.

    class
    ToolManagerMixin

    Mixin for tool callbacks.

    class
    StdOutCallbackHandler

    Callback handler that prints to std out.

    class
    BaseMessage

    Base abstract message class.

    Messages are the inputs and outputs of a chat model.

    Examples include HumanMessage, AIMessage, and SystemMessage.

    class
    LangChainTracer

    Implementation of the SharedTracer that POSTS to the LangChain endpoint.

    class
    ConsoleCallbackHandler

    Tracer that prints to the console.

    class
    AgentAction

    Represents a request to execute an action by an agent.

    The action consists of the name of the tool to execute and the input to pass to the tool. The log is used to pass along extra information about the action.

    class
    AgentFinish

    Final return value of an ActionAgent.

    Agents return an AgentFinish when they have reached a stopping condition.

    class
    Document

    Class for storing a piece of text and associated metadata.

    Note

    Document is for retrieval workflows, not chat I/O. For sending text to an LLM in a conversation, use message types from langchain.messages.

    class
    ChatGenerationChunk

    ChatGeneration chunk.

    ChatGeneration chunks can be concatenated with other ChatGeneration chunks.

    class
    GenerationChunk

    GenerationChunk, which can be concatenated with other Generation chunks.

    class
    LLMResult

    A container for results of an LLM call.

    Both chat models and LLMs generate an LLMResult object. This object contains the generated outputs and any additional information that the model provider wants to return.

    class
    RunnableConfig

    Configuration for a Runnable.

    Note

    Custom values

    The TypedDict has total=False set intentionally to:

    • Allow partial configs to be created and merged together via merge_configs
    • Support config propagation from parent to child runnables via var_child_runnable_config (a ContextVar that automatically passes config down the call stack without explicit parameter passing), where configs are merged rather than replaced
    Example
    # Parent sets tags
    chain.invoke(input, config={"tags": ["parent"]})
    # Child automatically inherits and can add:
    # ensure_config({"tags": ["child"]}) -> {"tags": ["parent", "child"]}
    class
    BaseRunManager

    Base class for run manager (a bound callback manager).

    class
    RunManager

    Synchronous run manager.

    class
    ParentRunManager

    Synchronous parent run manager.

    class
    AsyncRunManager

    Async run manager.

    class
    AsyncParentRunManager

    Async parent run manager.

    class
    CallbackManagerForLLMRun

    Callback manager for LLM run.

    class
    AsyncCallbackManagerForLLMRun

    Async callback manager for LLM run.

    class
    CallbackManagerForChainRun

    Callback manager for chain run.

    class
    AsyncCallbackManagerForChainRun

    Async callback manager for chain run.

    class
    CallbackManagerForToolRun

    Callback manager for tool run.

    class
    AsyncCallbackManagerForToolRun

    Async callback manager for tool run.

    class
    CallbackManagerForRetrieverRun

    Callback manager for retriever run.

    class
    AsyncCallbackManagerForRetrieverRun

    Async callback manager for retriever run.

    class
    CallbackManager

    Callback manager for LangChain.

    class
    CallbackManagerForChainGroup

    Callback manager for the chain group.

    class
    AsyncCallbackManager

    Async callback manager that handles callbacks from LangChain.

    class
    AsyncCallbackManagerForChainGroup

    Async callback manager for the chain group.

    Type Aliases

    typeAlias
    Callbacks: list[BaseCallbackHandler] | BaseCallbackManager | None
    View source on GitHub