Skip to main content

Triggers

Triggers

toothfairyai@latest…

Manager for event-driven agent triggers.

Triggers invoke an agent when a configured event source fires (native ToothFairyAI events or external provider events such as Google Drive, Slack, GitHub, etc.).

Example:

>>> client = ToothFairyClient(api_key="...", workspace_id="...")
>>> trigger = client.triggers.create(
... name="Slack mention",
... agent_id="agent-123",
... event_source_type="EXTERNAL",
... event_config={"provider": "slack", "acquisitionMode": "WEBHOOK"},
... )

Accessed via client.triggers.

Methods

MethodHTTPEndpoint
createPOSTPOST /trigger/create
updatePOSTPOST /trigger/update
getGETGET /trigger/get/{trigger_id}
deleteDELETEDELETE /trigger/delete/{trigger_id}
listGETGET /trigger/list
pausederived
resumederived
get_by_agentderived
get_activederived
searchderived

create

Create a new trigger.

def create(
name: str,
agent_id: str,
event_source_type: Any,
custom_prompt_id: Optional[str] = None,
description: Optional[str] = None,
forced_prompt: Optional[str] = None,
event_config: Optional[Union[TriggerExternalConfig, Dict[str, Any]]] = None,
is_active: bool = True,
status: Optional[TriggerStatusRequest] = None,
execution_config: Optional[Union[CronExecutionConfig, Dict[str, Any]]] = None,
notification_config: Optional[Union[CronNotificationConfig, Dict[str, Any]]] = None,
retry_config: Optional[Union[CronRetryConfig, Dict[str, Any]]] = None,
metadata: Optional[Dict[str, Any]] = None
) -> Trigger

Endpoint: POST /trigger/create · API service

Request fields

FieldTypeRequiredDescription
idstringnoUnique identifier
workspaceidstringyesYour workspace ID (UUID v4). Auto-injected by the SDK client from your configuration; you do not need to set it manually.
namestringyesName of the resource
descriptionstringnoDetailed description of purpose and capabilities
forcedPromptstringnoForced prompt text to use for the job (max 1024 chars)
agentIDstringyesID of the agent associated with this resource
customPromptIDstringnoID of a custom prompt to use
eventSourceTypestringyesEvent source type: NATIVE (internal events) or EXTERNAL (third-party provider events)

Allowed: NATIVE, EXTERNAL | | eventConfig | string | no | JSON-encoded event configuration. NATIVE requires eventType + optional dataFilter. EXTERNAL requires provider, providerEvent, acquisitionMode (POLLING/WEBHOOK), and pollConfig.intervalSeconds (60/120/300/600/1800) | | isActive | boolean | no | Whether the job is currently active | | status | string | no | Current status of the resource

Allowed: ARMED, PAUSED, PENDING, RUNNING, FAILED, COMPLETED, DISABLED | | executionConfig | string | no | JSON-encoded execution configuration | | notificationConfig | string | no | JSON-encoded notification configuration | | retryConfig | string | no | JSON-encoded retry policy configuration | | metadata | string | no | Arbitrary metadata key-value pairs (JSON) | | lastTriggeredAt | string | no | Timestamp when the trigger last fired | | lastEventID | string | no | ID of the last event that triggered this trigger | | triggerCount | integer | no | Number of times this trigger has fired | | createdBy | string | no | ID of the user who created this resource | | updatedBy | string | no | ID of the user who last updated this resource | | createdAt | string | no | Timestamp when this resource was created | | updatedAt | string | no | Timestamp when this resource was last updated |

The Python SDK accepts snake_case keyword arguments and converts them to the camelCase wire fields shown above.

Response fields

FieldTypeDescription
idstringUnique identifier
namestringName of the resource
descriptionstringDetailed description of purpose and capabilities
agentIDstringID of the agent associated with this resource
customPromptIDstringID of a custom prompt to use
forcedPromptstringForced prompt text to use for the job (max 1024 chars)
eventSourceTypestringEvent source type: NATIVE (internal events) or EXTERNAL (third-party provider events)

Allowed: NATIVE, EXTERNAL | | eventConfig | object | JSON-encoded event configuration. NATIVE requires eventType + optional dataFilter. EXTERNAL requires provider, providerEvent, acquisitionMode (POLLING/WEBHOOK), and pollConfig.intervalSeconds (60/120/300/600/1800) | | isActive | boolean | Whether the job is currently active | | status | string | Current status of the resource

Allowed: ARMED, PAUSED, DISABLED, FIRING, COMPLETED, FAILED, PENDING | | lastTriggeredAt | string | Timestamp when the trigger last fired | | lastEventID | string | ID of the last event that triggered this trigger | | triggerCount | integer | Number of times this trigger has fired | | executionConfig | object | JSON-encoded execution configuration | | notificationConfig | object | JSON-encoded notification configuration | | retryConfig | object | JSON-encoded retry policy configuration | | workspaceID | string | Unique workspace identifier (UUID v4) | | createdBy | string | ID of the user who created this resource | | updatedBy | string | ID of the user who last updated this resource | | createdAt | string | Timestamp when this resource was created | | updatedAt | string | Timestamp when this resource was last updated | | metadata | object | Arbitrary metadata key-value pairs (JSON) |

Example

client.triggers.create(name="…", agent_id="agent-id", event_source_type=)

update

Update a trigger.

def update(trigger_id: str) -> Trigger

Endpoint: POST /trigger/update · API service

Request fields

FieldTypeRequiredDescription
idstringyesUnique identifier
workspaceidstringnoYour workspace ID (UUID v4). Auto-injected by the SDK client from your configuration; you do not need to set it manually.
namestringnoName of the resource
descriptionstringnoDetailed description of purpose and capabilities
forcedPromptstringnoForced prompt text to use for the job (max 1024 chars)
agentIDstringnoID of the agent associated with this resource
customPromptIDstringnoID of a custom prompt to use
eventSourceTypestringnoEvent source type: NATIVE (internal events) or EXTERNAL (third-party provider events)

Allowed: NATIVE, EXTERNAL | | eventConfig | string | no | JSON-encoded event configuration. NATIVE requires eventType + optional dataFilter. EXTERNAL requires provider, providerEvent, acquisitionMode (POLLING/WEBHOOK), and pollConfig.intervalSeconds (60/120/300/600/1800) | | isActive | boolean | no | Whether the job is currently active | | status | string | no | Current status of the resource

Allowed: ARMED, PAUSED, PENDING, RUNNING, FAILED, COMPLETED, DISABLED | | executionConfig | string | no | JSON-encoded execution configuration | | notificationConfig | string | no | JSON-encoded notification configuration | | retryConfig | string | no | JSON-encoded retry policy configuration | | metadata | string | no | Arbitrary metadata key-value pairs (JSON) | | lastTriggeredAt | string | no | Timestamp when the trigger last fired | | lastEventID | string | no | ID of the last event that triggered this trigger | | triggerCount | integer | no | Number of times this trigger has fired | | createdBy | string | no | ID of the user who created this resource | | updatedBy | string | no | ID of the user who last updated this resource | | createdAt | string | no | Timestamp when this resource was created | | updatedAt | string | no | Timestamp when this resource was last updated |

The Python SDK accepts snake_case keyword arguments and converts them to the camelCase wire fields shown above.

Response

Returns the Trigger object — fields documented in the create section above.

Example

client.triggers.update(trigger_id="agent-id")

get

Get a trigger by ID.

def get(trigger_id: str) -> Trigger

Endpoint: GET /trigger/get/{trigger_id} · API service

Response

Returns the Trigger object — fields documented in the create section above.

Example

client.triggers.get(trigger_id="agent-id")

delete

Delete a trigger.

def delete(trigger_id: str) -> Dict[str, bool]

Endpoint: DELETE /trigger/delete/{trigger_id} · API service

Response fields

FieldTypeDescription
successbooleanOperation success status
dataobjectResponse data
messagestringOptional success message

Example

client.triggers.delete(trigger_id="agent-id")

list

List all triggers.

def list(
limit: Optional[int] = None,
offset: Optional[int] = None
) -> ListResponse

Endpoint: GET /trigger/list · API service

Response

Returns the Trigger object — fields documented in the create section above.

Example

client.triggers.list()

pause

Pause (disarm) a trigger.

def pause(trigger_id: str) -> Trigger

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example

client.triggers.pause(trigger_id="agent-id")

resume

Resume (arm) a paused trigger.

def resume(trigger_id: str) -> Trigger

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example

client.triggers.resume(trigger_id="agent-id")

get_by_agent

Get triggers by agent ID.

def get_by_agent(agent_id: str) -> List[Trigger]

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example

client.triggers.get_by_agent(agent_id="agent-id")

get_active

Get all active (armed) triggers.

def get_active() -> List[Trigger]

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example

client.triggers.get_active()

Search triggers by name.

def search(search_term: str) -> List[Trigger]

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example

client.triggers.search(search_term="…")