Home / Function/ on_tool_end() — langchain Function Reference

on_tool_end() — langchain Function Reference

Architecture documentation for the on_tool_end() function in event_stream.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  3431946e_3bda_d7f5_8ceb_4e455bf4d03d["on_tool_end()"]
  33d093c4_1ed0_fc6a_17c6_762d4c5cfa04["_AstreamEventsCallbackHandler"]
  3431946e_3bda_d7f5_8ceb_4e455bf4d03d -->|defined in| 33d093c4_1ed0_fc6a_17c6_762d4c5cfa04
  f3f30716_b889_9f3d_db23_c53fb64b7cf1["_get_tool_run_info_with_inputs()"]
  3431946e_3bda_d7f5_8ceb_4e455bf4d03d -->|calls| f3f30716_b889_9f3d_db23_c53fb64b7cf1
  87f79bee_f9c5_8262_1829_62f633c4f870["_send()"]
  3431946e_3bda_d7f5_8ceb_4e455bf4d03d -->|calls| 87f79bee_f9c5_8262_1829_62f633c4f870
  9aed8e4f_9d4c_016f_aa43_c5908015cf8d["_get_parent_ids()"]
  3431946e_3bda_d7f5_8ceb_4e455bf4d03d -->|calls| 9aed8e4f_9d4c_016f_aa43_c5908015cf8d
  style 3431946e_3bda_d7f5_8ceb_4e455bf4d03d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tracers/event_stream.py lines 731–749

    async def on_tool_end(self, output: Any, *, run_id: UUID, **kwargs: Any) -> None:
        """End a trace for a tool run."""
        run_info, inputs = self._get_tool_run_info_with_inputs(run_id)

        self._send(
            {
                "event": "on_tool_end",
                "data": {
                    "output": output,
                    "input": inputs,
                },
                "run_id": str(run_id),
                "name": run_info["name"],
                "tags": run_info["tags"],
                "metadata": run_info["metadata"],
                "parent_ids": self._get_parent_ids(run_id),
            },
            "tool",
        )

Domain

Subdomains

Frequently Asked Questions

What does on_tool_end() do?
on_tool_end() is a function in the langchain codebase, defined in libs/core/langchain_core/tracers/event_stream.py.
Where is on_tool_end() defined?
on_tool_end() is defined in libs/core/langchain_core/tracers/event_stream.py at line 731.
What does on_tool_end() call?
on_tool_end() calls 3 function(s): _get_parent_ids, _get_tool_run_info_with_inputs, _send.

Analyze Your Own Codebase

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

Try Supermodel Free