Home / Class/ RunnableConfig Class — langchain Architecture

RunnableConfig Class — langchain Architecture

Architecture documentation for the RunnableConfig class in config.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  7370835a_e974_def1_6538_c09e500f69bc["RunnableConfig"]
  4d16987d_fe07_22bb_f46d_7daeb24e0367["config.py"]
  7370835a_e974_def1_6538_c09e500f69bc -->|defined in| 4d16987d_fe07_22bb_f46d_7daeb24e0367

Relationship Graph

Source Code

libs/core/langchain_core/runnables/config.py lines 51–122

class RunnableConfig(TypedDict, total=False):
    """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

            ```python
            # Parent sets tags
            chain.invoke(input, config={"tags": ["parent"]})
            # Child automatically inherits and can add:
            # ensure_config({"tags": ["child"]}) -> {"tags": ["parent", "child"]}
            ```
    """

    tags: list[str]
    """Tags for this call and any sub-calls (e.g. a Chain calling an LLM).

    You can use these to filter calls.
    """

    metadata: dict[str, Any]
    """Metadata for this call and any sub-calls (e.g. a Chain calling an LLM).

    Keys should be strings, values should be JSON-serializable.
    """

    callbacks: Callbacks
    """Callbacks for this call and any sub-calls (e.g. a Chain calling an LLM).

    Tags are passed to all callbacks, metadata is passed to handle*Start callbacks.
    """

    run_name: str
    """Name for the tracer run for this call.

    Defaults to the name of the class."""

    max_concurrency: int | None
    """Maximum number of parallel calls to make.

    If not provided, defaults to `ThreadPoolExecutor`'s default.
    """

    recursion_limit: int
    """Maximum number of times a call can recurse.

    If not provided, defaults to `25`.
    """

    configurable: dict[str, Any]
    """Runtime values for attributes previously made configurable on this `Runnable`,
    or sub-`Runnable` objects, through `configurable_fields` or
    `configurable_alternatives`.

    Check `output_schema` for a description of the attributes that have been made
    configurable.
    """

    run_id: uuid.UUID | None
    """Unique identifier for the tracer run for this call.

    If not provided, a new UUID will be generated.
    """

Frequently Asked Questions

What is the RunnableConfig class?
RunnableConfig is a class in the langchain codebase, defined in libs/core/langchain_core/runnables/config.py.
Where is RunnableConfig defined?
RunnableConfig is defined in libs/core/langchain_core/runnables/config.py at line 51.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free