aixplain.v2.tool
Tool resource module for managing tools and their integrations.
ToolResult Objects
@dataclass_json
@dataclass(repr=False)
class ToolResult(Result)
Result for a tool.
Tool Objects
@dataclass_json
@dataclass(repr=False)
class Tool(Model, DeleteResourceMixin[BaseDeleteParams, DeleteResult],
ActionMixin)
Resource for tools.
This class represents a tool resource that matches the backend structure. Tools can be integrations, utilities, or other specialized resources. Inherits from Model to reuse shared attributes and functionality.
DEFAULT_INTEGRATION_ID
Python Sandbox (script) integration
integration_path
@property
def integration_path() -> Optional[str]
The path of the integration (e.g. "aixplain/python-sandbox").
Available when the integration has been resolved to an
Integration object that carries a path attribute.
Returns None when the integration has not been resolved yet.
__post_init__
def __post_init__() -> None
Initialize tool after dataclass creation.
actions
@cached_property
def actions() -> Actions
Collection of actions available on this tool.
inputs
@property
def inputs()
Tools have multiple actions — use tool.actions['action_name'].inputs instead.
inputs
@inputs.setter
def inputs(value)
Prevent setting inputs directly on tools.
list_actions
def list_actions() -> List[ActionSpec]
List available actions for the tool (with integration fallback).
list_inputs
def list_inputs(*actions: str) -> List[ActionSpec]
List available inputs for specified actions.
Deprecated: Use tool.actions['action_name'].inputs to discover and configure action inputs instead.
validate_allowed_actions
def validate_allowed_actions() -> None
Validate that all allowed actions are available for this tool.
get_parameters
def get_parameters() -> List[dict]
Get parameters for the tool in the format expected by agent saving.
as_tool
def as_tool() -> dict
Serialize this tool for agent creation.
run
def run(*args: Any, **kwargs: Unpack[ModelRunParams]) -> ToolResult
Run the tool.