Skip to main content
Version: v2.0

aixplain.v2.trigger

Trigger management module for the aiXplain v2 API.

A Trigger fires an agent with an input (the query) either on a time schedule (once / daily / weekly / monthly / interval) or on an external event (e.g. a Composio integration event such as a new Gmail email).

Time triggers map straight onto POST/GET/PUT/DELETE /v1/triggers. Event triggers are orchestrated over the existing endpoints: the SDK activates the Composio trigger on a connected tool via the model-execute endpoint (the same mechanism used by integration.actions), then persists the returned trigger id through /v1/triggers.

TriggerRepeatRule Objects

@dataclass_json

@dataclass
class TriggerRepeatRule()

[view_source]

Interval rule for a recurring schedule (e.g. every 2 hours).

TriggerConfiguration Objects

@dataclass_json

@dataclass
class TriggerConfiguration()

[view_source]

Structured time-schedule configuration (mirrors the backend config).

TriggerSearchParams Objects

class TriggerSearchParams(BaseSearchParams)

[view_source]

Search parameters for triggers (filter by agent).

TriggerGetParams Objects

class TriggerGetParams(BaseGetParams)

[view_source]

Get parameters for triggers.

TriggerDeleteParams Objects

class TriggerDeleteParams(BaseDeleteParams)

[view_source]

Delete parameters for triggers.

Trigger Objects

@dataclass_json

@dataclass(repr=False)
class Trigger(BaseResource, SearchResourceMixin[TriggerSearchParams,
"Trigger"],
GetResourceMixin[TriggerGetParams, "Trigger"],
DeleteResourceMixin[TriggerDeleteParams, DeleteResult])

[view_source]

A schedule/event trigger that fires an agent with a fixed input.

Time trigger examples:

aix.Trigger(name="Launch reminder", agent=agent, input="Remind the team.",
run_at="2026-01-26T12:00:00Z").save() # once
aix.Trigger(name="Daily digest", agent=agent, input="Summarise the news.",
every="day", at="09:00", timezone="Europe/London").save() # daily
aix.Trigger(name="Hourly check", agent=agent, input="Check the queue.",
every="hour", interval=2).save() # every 2 hours
aix.Trigger(name="Weekly report", agent=agent, input="Compile the report.",
every="week", on=["mon", "thu"], at="17:00").save() # weekly
aix.Trigger(name="Invoice run", agent=agent, input="Generate invoices.",
every="month", on=[1, 15], at="09:00").save() # monthly

Event trigger example (requires a connected tool):

gmail = aix.Integration.get("composio/gmail")
tool = gmail.connect(...)
aix.Trigger(name="Triage inbox", agent=agent, input="Triage this email.",
event=tool.triggers["NEW_EMAIL"]).save()

Manage:

t = aix.Trigger.get("<id>")
aix.Trigger.search(agent=agent) # -> Page
t.enabled = False; t.save() # disable (re-enable with True)
t.delete()

PAGINATE_ITEMS_KEY

bare array response

__post_init__

def __post_init__() -> None

[view_source]

Translate friendly construction kwargs into backend-shaped fields.

When rehydrating from the backend (id already set), populate the friendly schedule fields from configuration without rebuilding it.

before_save

def before_save(*args: Any, **kwargs: Any) -> None

[view_source]

Activate the Composio trigger before persisting a new event trigger.

build_save_payload

def build_save_payload(**kwargs: Any) -> Dict[str, Any]

[view_source]

Build the whitelisted payload for POST/PUT /v1/triggers.

The backend uses forbidNonWhitelisted validation, so only the fields accepted by TriggerInput are sent (never read-only fields).

@classmethod
def search(cls,
agent: Optional[Any] = None,
agent_id: Optional[str] = None,
**kwargs: Any) -> Page["Trigger"]

[view_source]

List triggers for the team, optionally filtered by agent.

Arguments:

  • agent - An Agent instance (or anything with .id) to filter by.
  • agent_id - An agent id string to filter by.
  • **kwargs - Additional options forwarded to page building (e.g. page_number).

Returns:

Page[Trigger]

list

@classmethod
def list(cls, **kwargs: Any) -> List["Trigger"]

[view_source]

Convenience wrapper returning the results list directly.

delete

def delete(*args: Any, **kwargs: Any) -> DeleteResult

[view_source]

Delete the trigger (deactivating the Composio trigger for events).

schedule_type

@property
def schedule_type() -> Optional[str]

[view_source]

The schedule type (once/daily/weekly/monthly/recurring), if a time trigger.

__repr__

def __repr__() -> str

[view_source]

Return a concise representation.