aixplain.v2.integration
Integration module for managing external service integrations.
ActionInputSpec Objects
@dataclass_json
@dataclass
class ActionInputSpec()
Backend input-parameter specification for an action (deserialization only).
ActionSpec Objects
@dataclass_json
@dataclass(repr=False)
class ActionSpec()
Backend action specification (deserialization only).
__repr__
def __repr__() -> str
Return a concise representation of the action spec.
ToolId Objects
@dataclass_json
@dataclass
class ToolId()
Result for tool operations.
IntegrationResult Objects
@dataclass_json
@dataclass
class IntegrationResult(Result)
Result for connection operations.
The backend returns the connection ID in data.id.
IntegrationSearchParams Objects
class IntegrationSearchParams(BaseSearchParams)
Parameters for listing integrations.
TriggerTypeSpec Objects
@dataclass_json
@dataclass
class TriggerTypeSpec()
Backend spec for an available external trigger type (deserialization only).
TriggerEventOption Objects
class TriggerEventOption()
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
Initialize an event option.
configure
def configure(**values: Any) -> "TriggerEventOption"
Set config values passed to the trigger on activation.
__repr__
def __repr__() -> str
Return a concise representation.
TriggerTypes Objects
class TriggerTypes()
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
Initialize from backend specs and an optional connection id.
__getitem__
def __getitem__(key: str) -> TriggerEventOption
Return the TriggerEventOption for key (case-insensitive).
__contains__
def __contains__(key: object) -> bool
Return whether key matches an available trigger event.
__iter__
def __iter__()
Iterate over available trigger event slugs.
__len__
def __len__() -> int
Return the number of available trigger events.
__repr__
def __repr__() -> str
Return TriggerTypes(['SLUG', ...]).
ActionMixin Objects
@dataclass
class ActionMixin()
Mixin class providing action-related functionality for integrations and tools.
list_actions
def list_actions() -> List[ActionSpec]
List available actions for the integration.
Returns:
List of ActionSpec objects from the backend.
list_inputs
def list_inputs(*actions: str) -> List[ActionSpec]
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
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]
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
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
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)
Resource for integrations.
Integrations are a subtype of models with Function.CONNECTOR. All connection logic is centralized here.
run
def run(**kwargs: Any) -> IntegrationResult
Run the integration with validation.
connect
def connect(**kwargs: Any) -> "Tool"
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_urlwill 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
Handle the response from the integration.