Home / Class/ BetaAsyncFunctionTool Class — anthropic-sdk-python Architecture

BetaAsyncFunctionTool Class — anthropic-sdk-python Architecture

Architecture documentation for the BetaAsyncFunctionTool class in _beta_functions.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  67951991_8e94_eb92_6283_43e8d4a4c89f["BetaAsyncFunctionTool"]
  2f4a4b61_2541_5c7b_c70e_93f4b752f987["_beta_functions.py"]
  67951991_8e94_eb92_6283_43e8d4a4c89f -->|defined in| 2f4a4b61_2541_5c7b_c70e_93f4b752f987
  dd1c8c22_ca06_011a_9ac9_782af6af7e66["call()"]
  67951991_8e94_eb92_6283_43e8d4a4c89f -->|method| dd1c8c22_ca06_011a_9ac9_782af6af7e66

Relationship Graph

Source Code

src/anthropic/lib/tools/_beta_functions.py lines 191–202

class BetaAsyncFunctionTool(BaseFunctionTool[AsyncFunctionT]):
    async def call(self, input: object) -> BetaFunctionToolResultType:
        if not iscoroutinefunction(self.func):
            raise RuntimeError("Cannot call a synchronous function asynchronously. Use `@tool` instead.")

        if not is_dict(input):
            raise TypeError(f"Input must be a dictionary, got {type(input).__name__}")

        try:
            return await self._func_with_validate(**cast(Any, input))
        except pydantic.ValidationError as e:
            raise ValueError(f"Invalid arguments for function {self.name}") from e

Frequently Asked Questions

What is the BetaAsyncFunctionTool class?
BetaAsyncFunctionTool is a class in the anthropic-sdk-python codebase, defined in src/anthropic/lib/tools/_beta_functions.py.
Where is BetaAsyncFunctionTool defined?
BetaAsyncFunctionTool is defined in src/anthropic/lib/tools/_beta_functions.py at line 191.

Analyze Your Own Codebase

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

Try Supermodel Free