Home / Function/ on_tool_error() — langchain Function Reference

on_tool_error() — langchain Function Reference

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

Function python Observability Tracers calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  7b1515cd_3108_e749_226d_30eb77f926e0["on_tool_error()"]
  0f6b3261_31fa_c34e_ca33_cb141bdf78ff["BaseTracer"]
  7b1515cd_3108_e749_226d_30eb77f926e0 -->|defined in| 0f6b3261_31fa_c34e_ca33_cb141bdf78ff
  f8eb0e19_0f22_c54c_2715_ebbd3aa1cb00["on_tool_error()"]
  f8eb0e19_0f22_c54c_2715_ebbd3aa1cb00 -->|calls| 7b1515cd_3108_e749_226d_30eb77f926e0
  9191b24f_a202_df21_16c5_e2608083aef8["_end_trace()"]
  7b1515cd_3108_e749_226d_30eb77f926e0 -->|calls| 9191b24f_a202_df21_16c5_e2608083aef8
  9a70c96e_33ef_9783_8499_a59cc28d833f["_on_tool_error()"]
  7b1515cd_3108_e749_226d_30eb77f926e0 -->|calls| 9a70c96e_33ef_9783_8499_a59cc28d833f
  f8eb0e19_0f22_c54c_2715_ebbd3aa1cb00["on_tool_error()"]
  7b1515cd_3108_e749_226d_30eb77f926e0 -->|calls| f8eb0e19_0f22_c54c_2715_ebbd3aa1cb00
  style 7b1515cd_3108_e749_226d_30eb77f926e0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tracers/base.py lines 408–431

    def on_tool_error(
        self,
        error: BaseException,
        *,
        run_id: UUID,
        **kwargs: Any,
    ) -> Run:
        """Handle an error for a tool run.

        Args:
            error: The error.
            run_id: The run ID.
            **kwargs: Additional arguments.

        Returns:
            The run.
        """
        tool_run = self._errored_tool_run(
            error=error,
            run_id=run_id,
        )
        self._end_trace(tool_run)
        self._on_tool_error(tool_run)
        return tool_run

Domain

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free