Home / Function/ on_tool_end() — langchain Function Reference

on_tool_end() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a96ffe4a_3f3f_2b4a_c2b4_e81de4567692["on_tool_end()"]
  52737fd4_dd58_4289_8b70_0131f09b23a5["FileCallbackHandler"]
  a96ffe4a_3f3f_2b4a_c2b4_e81de4567692 -->|defined in| 52737fd4_dd58_4289_8b70_0131f09b23a5
  efeb47b6_76c6_8f45_76b9_d26fbc90c538["_write()"]
  a96ffe4a_3f3f_2b4a_c2b4_e81de4567692 -->|calls| efeb47b6_76c6_8f45_76b9_d26fbc90c538
  style a96ffe4a_3f3f_2b4a_c2b4_e81de4567692 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/callbacks/file.py lines 210–234

    def on_tool_end(
        self,
        output: str,
        color: str | None = None,
        observation_prefix: str | None = None,
        llm_prefix: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Handle tool end by writing the output with optional prefixes.

        Args:
            output: The tool output to write.
            color: Color override for this specific output.

                If `None`, uses `self.color`.
            observation_prefix: Optional prefix to write before the output.
            llm_prefix: Optional prefix to write after the output.
            **kwargs: Additional keyword arguments.

        """
        if observation_prefix is not None:
            self._write(f"\n{observation_prefix}")
        self._write(output)
        if llm_prefix is not None:
            self._write(f"\n{llm_prefix}")

Domain

Subdomains

Calls

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/callbacks/file.py.
Where is on_tool_end() defined?
on_tool_end() is defined in libs/core/langchain_core/callbacks/file.py at line 210.
What does on_tool_end() call?
on_tool_end() calls 1 function(s): _write.

Analyze Your Own Codebase

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

Try Supermodel Free