Home / Function/ on_agent_action() — langchain Function Reference

on_agent_action() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/langchain_core/callbacks/file.py lines 194–207

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

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

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

        """
        self._write(action.log, color=color or self.color)

Domain

Subdomains

Calls

Frequently Asked Questions

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