Home / Class/ CallbackManagerForToolRun Class — langchain Architecture

CallbackManagerForToolRun Class — langchain Architecture

Architecture documentation for the CallbackManagerForToolRun class in manager.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  2a2e251d_5806_39f1_7184_063568074b07["CallbackManagerForToolRun"]
  e85ab975_2820_2512_9967_d5636d6c818a["ParentRunManager"]
  2a2e251d_5806_39f1_7184_063568074b07 -->|extends| e85ab975_2820_2512_9967_d5636d6c818a
  ce853a9e_20ff_60f1_d46b_e3de29d95f93["ToolManagerMixin"]
  2a2e251d_5806_39f1_7184_063568074b07 -->|extends| ce853a9e_20ff_60f1_d46b_e3de29d95f93
  35cf5db6_bcb1_b854_6ebb_5e0368e51b58["manager.py"]
  2a2e251d_5806_39f1_7184_063568074b07 -->|defined in| 35cf5db6_bcb1_b854_6ebb_5e0368e51b58
  fa5cb974_6638_19d4_888f_93c315a35f61["on_tool_end()"]
  2a2e251d_5806_39f1_7184_063568074b07 -->|method| fa5cb974_6638_19d4_888f_93c315a35f61
  acbc1138_b689_1447_c0e3_6d2a9c4adead["on_tool_error()"]
  2a2e251d_5806_39f1_7184_063568074b07 -->|method| acbc1138_b689_1447_c0e3_6d2a9c4adead

Relationship Graph

Source Code

libs/core/langchain_core/callbacks/manager.py lines 1054–1105

class CallbackManagerForToolRun(ParentRunManager, ToolManagerMixin):
    """Callback manager for tool run."""

    def on_tool_end(
        self,
        output: Any,
        **kwargs: Any,
    ) -> None:
        """Run when the tool ends running.

        Args:
            output: The output of the tool.
            **kwargs: The keyword arguments to pass to the event handler

        """
        if not self.handlers:
            return
        handle_event(
            self.handlers,
            "on_tool_end",
            "ignore_agent",
            output,
            run_id=self.run_id,
            parent_run_id=self.parent_run_id,
            tags=self.tags,
            **kwargs,
        )

    def on_tool_error(
        self,
        error: BaseException,
        **kwargs: Any,
    ) -> None:
        """Run when tool errors.

        Args:
            error: The error.
            **kwargs: Additional keyword arguments.

        """
        if not self.handlers:
            return
        handle_event(
            self.handlers,
            "on_tool_error",
            "ignore_agent",
            error,
            run_id=self.run_id,
            parent_run_id=self.parent_run_id,
            tags=self.tags,
            **kwargs,
        )

Frequently Asked Questions

What is the CallbackManagerForToolRun class?
CallbackManagerForToolRun is a class in the langchain codebase, defined in libs/core/langchain_core/callbacks/manager.py.
Where is CallbackManagerForToolRun defined?
CallbackManagerForToolRun is defined in libs/core/langchain_core/callbacks/manager.py at line 1054.
What does CallbackManagerForToolRun extend?
CallbackManagerForToolRun extends ParentRunManager, ToolManagerMixin.

Analyze Your Own Codebase

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

Try Supermodel Free