Skip to main content
Version: v2.0

aixplain.v2.integration

Integration module for managing external service integrations.

ActionInputSpec Objects

@dataclass_json

@dataclass
class ActionInputSpec()

[view_source]

Backend input-parameter specification for an action (deserialization only).

ActionSpec Objects

@dataclass_json

@dataclass(repr=False)
class ActionSpec()

[view_source]

Backend action specification (deserialization only).

__repr__

def __repr__() -> str

[view_source]

Return a concise representation of the action spec.

ToolId Objects

@dataclass_json

@dataclass
class ToolId()

[view_source]

Result for tool operations.

IntegrationResult Objects

@dataclass_json

@dataclass
class IntegrationResult(Result)

[view_source]

Result for connection operations.

The backend returns the connection ID in data.id.

IntegrationSearchParams Objects

class IntegrationSearchParams(BaseSearchParams)

[view_source]

Parameters for listing integrations.

TriggerTypeSpec Objects

@dataclass_json

@dataclass
class TriggerTypeSpec()

[view_source]

Backend spec for an available external trigger type (deserialization only).

TriggerEventOption Objects

class TriggerEventOption()

[view_source]

A selectable external event option (e.g. gmail.triggers["NEW_EMAIL"]).

Carries the event slug and its config schema. When sourced from a connected tool it also carries connection_id (the tool id), which is required to activate the trigger. Pass it to aix.Trigger(event=...).

__init__

def __init__(slug: str,
name: Optional[str] = None,
description: Optional[str] = None,
config: Optional[Any] = None,
connection_id: Optional[str] = None) -> None

[view_source]

Initialize an event option.

configure

def configure(**values: Any) -> "TriggerEventOption"

[view_source]

Set config values passed to the trigger on activation.

__repr__

def __repr__() -> str

[view_source]

Return a concise representation.

TriggerTypes Objects

class TriggerTypes()

[view_source]

Browsable collection of TriggerEventOption for an integration/tool.

Supports integration.triggers["NEW_EMAIL"] (case-insensitive), iteration, in, and len.

__init__

def __init__(specs: List[TriggerTypeSpec],
connection_id: Optional[str] = None) -> None

[view_source]

Initialize from backend specs and an optional connection id.

__getitem__

def __getitem__(key: str) -> TriggerEventOption

[view_source]

Return the TriggerEventOption for key (case-insensitive).

__contains__

def __contains__(key: object) -> bool

[view_source]

Return whether key matches an available trigger event.

__iter__

def __iter__()

[view_source]

Iterate over available trigger event slugs.

__len__

def __len__() -> int

[view_source]

Return the number of available trigger events.

__repr__

def __repr__() -> str

[view_source]

Return TriggerTypes(['SLUG', ...]).

ActionMixin Objects

@dataclass
class ActionMixin()

[view_source]

Mixin class providing action-related functionality for integrations and tools.

list_actions

def list_actions() -> List[ActionSpec]

[view_source]

List available actions for the integration.

Returns:

List of ActionSpec objects from the backend.

list_inputs

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

[view_source]

List available inputs for the integration.

Deprecated: Use tool.actions['action_name'].inputs to discover and configure action inputs instead.

actions

@cached_property
def actions() -> Actions

[view_source]

Collection of actions with their inputs.

Returns:

Actions collection. Access individual actions via tool.actions['ACTION_NAME'] which returns an Action whose .inputs property lazily fetches input specs.

list_trigger_types

def list_trigger_types() -> List[TriggerTypeSpec]

[view_source]

List available external event trigger types for the integration/tool.

Uses the same model-execute mechanism as list_actions.

Returns:

List of TriggerTypeSpec objects from the backend.

triggers

@cached_property
def triggers() -> TriggerTypes

[view_source]

Browsable collection of external event options (like actions).

Pick an option and pass it to aix.Trigger(event=...). When accessed on a connected tool, each option carries the connection id needed to activate the trigger; on an unconnected integration it is discovery-only.

Returns:

TriggerTypes collection (e.g. gmail.triggers["NEW_EMAIL"]).

set_inputs

def set_inputs(inputs_dict: Dict[str, Dict[str, Any]]) -> None

[view_source]

Set multiple action inputs in bulk using a dictionary tree structure.

Arguments:

  • inputs_dict - {"ACTION_NAME": {"input_param": "value", ...}, ...}

Raises:

  • ValueError - If an action name is not found or invalid.
  • KeyError - If an input parameter is not found for an action.

Integration Objects

@dataclass_json

@dataclass
class Integration(Model, ActionMixin)

[view_source]

Resource for integrations.

Integrations are a subtype of models with Function.CONNECTOR. All connection logic is centralized here.

run

def run(**kwargs: Any) -> IntegrationResult

[view_source]

Run the integration with validation.

connect

def connect(**kwargs: Any) -> "Tool"

[view_source]

Connect the integration.

For OAuth-based integrations, the backend may return a redirect URL that the user must visit to complete authentication before using the tool.

Returns:

  • Tool - The created tool. If OAuth authentication is required, tool.redirect_url will contain the URL the user must visit.

Raises:

  • ValueError - If the connection fails (e.g., name already exists).

handle_run_response

def handle_run_response(response: dict, **kwargs: Any) -> IntegrationResult

[view_source]

Handle the response from the integration.