AsyncCallbackManagerForToolRun Class — langchain Architecture
Architecture documentation for the AsyncCallbackManagerForToolRun class in manager.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 60a9c36f_6098_d115_2e49_42190f9a0166["AsyncCallbackManagerForToolRun"] 3a2e20d8_f61b_1bdd_21d3_f60011fbae36["AsyncParentRunManager"] 60a9c36f_6098_d115_2e49_42190f9a0166 -->|extends| 3a2e20d8_f61b_1bdd_21d3_f60011fbae36 ce853a9e_20ff_60f1_d46b_e3de29d95f93["ToolManagerMixin"] 60a9c36f_6098_d115_2e49_42190f9a0166 -->|extends| ce853a9e_20ff_60f1_d46b_e3de29d95f93 35cf5db6_bcb1_b854_6ebb_5e0368e51b58["manager.py"] 60a9c36f_6098_d115_2e49_42190f9a0166 -->|defined in| 35cf5db6_bcb1_b854_6ebb_5e0368e51b58 80c3fbaf_6b98_5bdf_f875_8cf84cb5bf78["get_sync()"] 60a9c36f_6098_d115_2e49_42190f9a0166 -->|method| 80c3fbaf_6b98_5bdf_f875_8cf84cb5bf78 11ff2b9e_a7a1_9d18_775f_da9e5cf21a50["on_tool_end()"] 60a9c36f_6098_d115_2e49_42190f9a0166 -->|method| 11ff2b9e_a7a1_9d18_775f_da9e5cf21a50 d803c935_de41_d013_fe44_6a4576ad2296["on_tool_error()"] 60a9c36f_6098_d115_2e49_42190f9a0166 -->|method| d803c935_de41_d013_fe44_6a4576ad2296
Relationship Graph
Source Code
libs/core/langchain_core/callbacks/manager.py lines 1108–1172
class AsyncCallbackManagerForToolRun(AsyncParentRunManager, ToolManagerMixin):
"""Async callback manager for tool run."""
def get_sync(self) -> CallbackManagerForToolRun:
"""Get the equivalent sync `RunManager`.
Returns:
The sync `RunManager`.
"""
return CallbackManagerForToolRun(
run_id=self.run_id,
handlers=self.handlers,
inheritable_handlers=self.inheritable_handlers,
parent_run_id=self.parent_run_id,
tags=self.tags,
inheritable_tags=self.inheritable_tags,
metadata=self.metadata,
inheritable_metadata=self.inheritable_metadata,
)
async def on_tool_end(self, output: Any, **kwargs: Any) -> None:
"""Async run when the tool ends running.
Args:
output: The output of the tool.
**kwargs: Additional keyword arguments.
"""
if not self.handlers:
return
await ahandle_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,
)
async 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
await ahandle_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,
)
Source
Frequently Asked Questions
What is the AsyncCallbackManagerForToolRun class?
AsyncCallbackManagerForToolRun is a class in the langchain codebase, defined in libs/core/langchain_core/callbacks/manager.py.
Where is AsyncCallbackManagerForToolRun defined?
AsyncCallbackManagerForToolRun is defined in libs/core/langchain_core/callbacks/manager.py at line 1108.
What does AsyncCallbackManagerForToolRun extend?
AsyncCallbackManagerForToolRun extends AsyncParentRunManager, ToolManagerMixin.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free