_run() — langchain Function Reference
Architecture documentation for the _run() function in structured.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD f74917ca_a6e2_3af4_6178_214f9a94ab09["_run()"] 407227bd_4438_df24_1266_6521d5fea74a["StructuredTool"] f74917ca_a6e2_3af4_6178_214f9a94ab09 -->|defined in| 407227bd_4438_df24_1266_6521d5fea74a style f74917ca_a6e2_3af4_6178_214f9a94ab09 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/tools/structured.py lines 74–99
def _run(
self,
*args: Any,
config: RunnableConfig,
run_manager: CallbackManagerForToolRun | None = None,
**kwargs: Any,
) -> Any:
"""Use the tool.
Args:
*args: Positional arguments to pass to the tool
config: Configuration for the run
run_manager: Optional callback manager to use for the run
**kwargs: Keyword arguments to pass to the tool
Returns:
The result of the tool execution
"""
if self.func:
if run_manager and signature(self.func).parameters.get("callbacks"):
kwargs["callbacks"] = run_manager.get_child()
if config_param := _get_runnable_config_param(self.func):
kwargs[config_param] = config
return self.func(*args, **kwargs)
msg = "StructuredTool does not support sync invocation."
raise NotImplementedError(msg)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does _run() do?
_run() is a function in the langchain codebase, defined in libs/core/langchain_core/tools/structured.py.
Where is _run() defined?
_run() is defined in libs/core/langchain_core/tools/structured.py at line 74.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free