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

    config

    Configuration utilities for Runnable objects.

    Attributes

    attribute
    Input
    attribute
    Output
    attribute
    CONFIG_KEYS: list
    attribute
    COPIABLE_KEYS: list
    attribute
    DEFAULT_RECURSION_LIMIT: int
    attribute
    var_child_runnable_config: ContextVar[RunnableConfig | None]
    attribute
    P
    attribute
    T

    Functions

    function
    accepts_config

    Check if a callable accepts a config argument.

    function
    accepts_run_manager

    Check if a callable accepts a run_manager argument.

    function
    set_config_context

    Set the child Runnable config + tracing context.

    function
    ensure_config

    Ensure that a config is a dict with all keys present.

    function
    get_config_list

    Get a list of configs from a single config or a list of configs.

    It is useful for subclasses overriding batch() or abatch().

    function
    patch_config

    Patch a config with new values.

    function
    merge_configs

    Merge multiple configs into one.

    function
    call_func_with_variable_args

    Call function that may optionally accept a run_manager and/or config.

    function
    acall_func_with_variable_args

    Async call function that may optionally accept a run_manager and/or config.

    function
    get_callback_manager_for_config

    Get a callback manager for a config.

    function
    get_async_callback_manager_for_config

    Get an async callback manager for a config.

    function
    get_executor_for_config

    Get an executor for a config.

    function
    run_in_executor

    Run a function in an executor.

    Classes

    class
    AsyncCallbackManager

    Async callback manager that handles callbacks from LangChain.

    class
    CallbackManager

    Callback manager for LangChain.

    class
    LangChainTracer

    Implementation of the SharedTracer that POSTS to the LangChain endpoint.

    class
    BaseCallbackManager

    Base callback manager.

    class
    AsyncCallbackManagerForChainRun

    Async callback manager for chain run.

    class
    CallbackManagerForChainRun

    Callback manager for chain run.

    class
    EmptyDict

    Empty dict type.

    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
    ContextThreadPoolExecutor

    ThreadPoolExecutor that copies the context to the child thread.

    Type Aliases

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