Home / Function/ _arun() — langchain Function Reference

_arun() — langchain Function Reference

Architecture documentation for the _arun() function in structured.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  5d512b66_1125_dc03_009a_d80a632d5d85["_arun()"]
  407227bd_4438_df24_1266_6521d5fea74a["StructuredTool"]
  5d512b66_1125_dc03_009a_d80a632d5d85 -->|defined in| 407227bd_4438_df24_1266_6521d5fea74a
  style 5d512b66_1125_dc03_009a_d80a632d5d85 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tools/structured.py lines 101–130

    async def _arun(
        self,
        *args: Any,
        config: RunnableConfig,
        run_manager: AsyncCallbackManagerForToolRun | None = None,
        **kwargs: Any,
    ) -> Any:
        """Use the tool asynchronously.

        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.coroutine:
            if run_manager and signature(self.coroutine).parameters.get("callbacks"):
                kwargs["callbacks"] = run_manager.get_child()
            if config_param := _get_runnable_config_param(self.coroutine):
                kwargs[config_param] = config
            return await self.coroutine(*args, **kwargs)

        # If self.coroutine is None, then this will delegate to the default
        # implementation which is expected to delegate to _run on a separate thread.
        return await super()._arun(
            *args, config=config, run_manager=run_manager, **kwargs
        )

Subdomains

Frequently Asked Questions

What does _arun() do?
_arun() is a function in the langchain codebase, defined in libs/core/langchain_core/tools/structured.py.
Where is _arun() defined?
_arun() is defined in libs/core/langchain_core/tools/structured.py at line 101.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free