on_tool_start() — langchain Function Reference
Architecture documentation for the on_tool_start() function in manager.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a1fd3036_7b39_dbeb_ea97_f32d5d9822b0["on_tool_start()"] f2c19eb2_a092_16e7_b693_b7ae35a0bc8c["CallbackManager"] a1fd3036_7b39_dbeb_ea97_f32d5d9822b0 -->|defined in| f2c19eb2_a092_16e7_b693_b7ae35a0bc8c 99e09f49_82fe_9b97_1a99_8b1db9974286["on_tool_start()"] 99e09f49_82fe_9b97_1a99_8b1db9974286 -->|calls| a1fd3036_7b39_dbeb_ea97_f32d5d9822b0 99e09f49_82fe_9b97_1a99_8b1db9974286["on_tool_start()"] a1fd3036_7b39_dbeb_ea97_f32d5d9822b0 -->|calls| 99e09f49_82fe_9b97_1a99_8b1db9974286 8964b4e9_440e_18a7_2a15_a54a0b2b733c["handle_event()"] a1fd3036_7b39_dbeb_ea97_f32d5d9822b0 -->|calls| 8964b4e9_440e_18a7_2a15_a54a0b2b733c style a1fd3036_7b39_dbeb_ea97_f32d5d9822b0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/callbacks/manager.py lines 1458–1515
def on_tool_start(
self,
serialized: dict[str, Any] | None,
input_str: str,
run_id: UUID | None = None,
parent_run_id: UUID | None = None,
inputs: dict[str, Any] | None = None,
**kwargs: Any,
) -> CallbackManagerForToolRun:
"""Run when tool starts running.
Args:
serialized: Serialized representation of the tool.
input_str: The input to the tool as a string.
Non-string inputs are cast to strings.
run_id: ID for the run.
parent_run_id: The ID of the parent run.
inputs: The original input to the tool if provided.
Recommended for usage instead of input_str when the original input is
needed.
If provided, the inputs are expected to be formatted as a dict. The keys
will correspond to the named-arguments in the tool.
**kwargs: The keyword arguments to pass to the event handler
Returns:
The callback manager for the tool run.
"""
if run_id is None:
run_id = uuid7()
handle_event(
self.handlers,
"on_tool_start",
"ignore_agent",
serialized,
input_str,
run_id=run_id,
parent_run_id=self.parent_run_id,
tags=self.tags,
metadata=self.metadata,
inputs=inputs,
**kwargs,
)
return CallbackManagerForToolRun(
run_id=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,
)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does on_tool_start() do?
on_tool_start() is a function in the langchain codebase, defined in libs/core/langchain_core/callbacks/manager.py.
Where is on_tool_start() defined?
on_tool_start() is defined in libs/core/langchain_core/callbacks/manager.py at line 1458.
What does on_tool_start() call?
on_tool_start() calls 2 function(s): handle_event, on_tool_start.
What calls on_tool_start()?
on_tool_start() is called by 1 function(s): on_tool_start.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free