Home / Class/ _DirectlyInjectedToolArg Class — langchain Architecture

_DirectlyInjectedToolArg Class — langchain Architecture

Architecture documentation for the _DirectlyInjectedToolArg class in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  9dec4055_fef2_4ee6_3027_6b8b1014a98d["_DirectlyInjectedToolArg"]
  80cebff4_efbd_4311_85e9_de0dc81a7eee["base.py"]
  9dec4055_fef2_4ee6_3027_6b8b1014a98d -->|defined in| 80cebff4_efbd_4311_85e9_de0dc81a7eee

Relationship Graph

Source Code

libs/core/langchain_core/tools/base.py lines 1374–1393

class _DirectlyInjectedToolArg:
    """Annotation for tool arguments that are injected at runtime.

    Injected via direct type annotation, rather than annotated metadata.

    For example, `ToolRuntime` is a directly injected argument.

    Note the direct annotation rather than the verbose alternative:
    `Annotated[ToolRuntime, InjectedRuntime]`

    ```python
    from langchain_core.tools import tool, ToolRuntime


    @tool
    def foo(x: int, runtime: ToolRuntime) -> str:
        # use runtime.state, runtime.context, runtime.store, etc.
        ...
    ```
    """

Frequently Asked Questions

What is the _DirectlyInjectedToolArg class?
_DirectlyInjectedToolArg is a class in the langchain codebase, defined in libs/core/langchain_core/tools/base.py.
Where is _DirectlyInjectedToolArg defined?
_DirectlyInjectedToolArg is defined in libs/core/langchain_core/tools/base.py at line 1374.

Analyze Your Own Codebase

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

Try Supermodel Free