Skip to main content
Version: v2.0

aixplain.v2.tool

Tool resource module for managing tools and their integrations.

ToolResult Objects

@dataclass_json

@dataclass(repr=False)
class ToolResult(Result)

[view_source]

Result for a tool.

Tool Objects

@dataclass_json

@dataclass(repr=False)
class Tool(Model, DeleteResourceMixin[BaseDeleteParams, DeleteResult],
ActionMixin)

[view_source]

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]

[view_source]

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

[view_source]

Initialize tool after dataclass creation.

actions

@cached_property
def actions() -> Actions

[view_source]

Collection of actions available on this tool.

inputs

@property
def inputs()

[view_source]

Tools have multiple actions — use tool.actions['action_name'].inputs instead.

inputs

@inputs.setter
def inputs(value)

[view_source]

Prevent setting inputs directly on tools.

list_actions

def list_actions() -> List[ActionSpec]

[view_source]

List available actions for the tool (with integration fallback).

list_inputs

def list_inputs(*actions: str) -> List[ActionSpec]

[view_source]

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

[view_source]

Validate that all allowed actions are available for this tool.

get_parameters

def get_parameters() -> List[dict]

[view_source]

Get parameters for the tool in the format expected by agent saving.

as_tool

def as_tool() -> dict

[view_source]

Serialize this tool for agent creation.

run

def run(*args: Any, **kwargs: Unpack[ModelRunParams]) -> ToolResult

[view_source]

Run the tool.