Home / Function/ on_agent_finish() — langchain Function Reference

on_agent_finish() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/langchain_core/callbacks/file.py lines 254–267

    def on_agent_finish(
        self, finish: AgentFinish, color: str | None = None, **kwargs: Any
    ) -> None:
        """Handle agent finish by writing the finish log.

        Args:
            finish: The agent finish object containing the log to write.
            color: Color override for this specific output.

                If `None`, uses `self.color`.
            **kwargs: Additional keyword arguments.

        """
        self._write(finish.log, color=color or self.color, end="\n")

Domain

Subdomains

Calls

Frequently Asked Questions

What does on_agent_finish() do?
on_agent_finish() is a function in the langchain codebase, defined in libs/core/langchain_core/callbacks/file.py.
Where is on_agent_finish() defined?
on_agent_finish() is defined in libs/core/langchain_core/callbacks/file.py at line 254.
What does on_agent_finish() call?
on_agent_finish() 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