Home / Function/ _arun() — langchain Function Reference

_arun() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  752aa18a_898d_12da_39ba_cf8ce10bbd7d["_arun()"]
  6df01d08_9565_f3af_ca13_cbc05186b041["Tool"]
  752aa18a_898d_12da_39ba_cf8ce10bbd7d -->|defined in| 6df01d08_9565_f3af_ca13_cbc05186b041
  style 752aa18a_898d_12da_39ba_cf8ce10bbd7d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tools/simple.py lines 126–155

    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)

        # NOTE: this code is unreachable since _arun is only called if coroutine is not
        # None.
        return await super()._arun(
            *args, config=config, run_manager=run_manager, **kwargs
        )

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free