Home / Function/ on_tool_start() — langchain Function Reference

on_tool_start() — langchain Function Reference

Architecture documentation for the on_tool_start() function in base.py from the langchain codebase.

Function python Observability Tracers calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  6960ac87_9904_f051_9a03_c1f72b80f78d["on_tool_start()"]
  0f6b3261_31fa_c34e_ca33_cb141bdf78ff["BaseTracer"]
  6960ac87_9904_f051_9a03_c1f72b80f78d -->|defined in| 0f6b3261_31fa_c34e_ca33_cb141bdf78ff
  af854144_a34e_e08b_b43a_58573b084ed6["on_tool_start()"]
  af854144_a34e_e08b_b43a_58573b084ed6 -->|calls| 6960ac87_9904_f051_9a03_c1f72b80f78d
  e367264b_d5e2_1e7f_2b3a_e362236bcd24["_start_trace()"]
  6960ac87_9904_f051_9a03_c1f72b80f78d -->|calls| e367264b_d5e2_1e7f_2b3a_e362236bcd24
  06193a20_5e97_3a0b_9bc5_248b90e7cb0d["_on_tool_start()"]
  6960ac87_9904_f051_9a03_c1f72b80f78d -->|calls| 06193a20_5e97_3a0b_9bc5_248b90e7cb0d
  af854144_a34e_e08b_b43a_58573b084ed6["on_tool_start()"]
  6960ac87_9904_f051_9a03_c1f72b80f78d -->|calls| af854144_a34e_e08b_b43a_58573b084ed6
  style 6960ac87_9904_f051_9a03_c1f72b80f78d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tracers/base.py lines 343–385

    def on_tool_start(
        self,
        serialized: dict[str, Any],
        input_str: str,
        *,
        run_id: UUID,
        tags: list[str] | None = None,
        parent_run_id: UUID | None = None,
        metadata: dict[str, Any] | None = None,
        name: str | None = None,
        inputs: dict[str, Any] | None = None,
        **kwargs: Any,
    ) -> Run:
        """Start a trace for a tool run.

        Args:
            serialized: The serialized tool.
            input_str: The input string.
            run_id: The run ID.
            tags: The tags for the run.
            parent_run_id: The parent run ID.
            metadata: The metadata for the run.
            name: The name of the run.
            inputs: The inputs for the tool.
            **kwargs: Additional arguments.

        Returns:
            The run.
        """
        tool_run = self._create_tool_run(
            serialized=serialized,
            input_str=input_str,
            run_id=run_id,
            tags=tags,
            parent_run_id=parent_run_id,
            metadata=metadata,
            name=name,
            inputs=inputs,
            **kwargs,
        )
        self._start_trace(tool_run)
        self._on_tool_start(tool_run)
        return tool_run

Domain

Subdomains

Called By

Frequently Asked Questions

What does on_tool_start() do?
on_tool_start() is a function in the langchain codebase, defined in libs/core/langchain_core/tracers/base.py.
Where is on_tool_start() defined?
on_tool_start() is defined in libs/core/langchain_core/tracers/base.py at line 343.
What does on_tool_start() call?
on_tool_start() calls 3 function(s): _on_tool_start, _start_trace, on_tool_start.
What calls on_tool_start()?
on_tool_start() is called by 1 function(s): on_tool_start.

Analyze Your Own Codebase

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

Try Supermodel Free