Create Trigger
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:
res = mistral.beta.triggers.create(event_source_id="07adfb82-bcd1-462d-94df-cd3f8421627e", handler="spaces", action={
"primitive_id": "<id>",
"type": "start_workflow",
}, owner_type="workspace", title="<value>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
event_source_id |
str |
✔️ |
ID of the event source that fires this trigger |
handler |
models.TriggerHandler |
✔️ |
N/A |
action |
models.CreateTriggerAction |
✔️ |
N/A |
owner_type |
models.TriggersOwnerType |
✔️ |
N/A |
title |
str |
✔️ |
Human-readable title of the trigger |
filters |
OptionalNullable[str] |
➖ |
jmespath expression to filter events, e.g. event_type == 'push' && repository.name == 'dashboard' |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.Trigger
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.SDKError |
4XX, 5XX |
*/* |
List Triggers
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:
res = mistral.beta.triggers.list()
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
handler |
OptionalNullable[models.TriggerHandler] |
➖ |
Filter by handler type |
primitive_id |
OptionalNullable[str] |
➖ |
Filter by primitive ID (workflow, agent, or app) |
event_source_id |
OptionalNullable[str] |
➖ |
Filter by event source ID (webhook id) |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
List[models.Trigger]
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.SDKError |
4XX, 5XX |
*/* |
Get Trigger
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:
res = mistral.beta.triggers.get(trigger_id="8a031c37-160a-4451-9fb0-960dab51da01")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
trigger_id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.Trigger
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.SDKError |
4XX, 5XX |
*/* |
Delete Trigger
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:
mistral.beta.triggers.delete(trigger_id="c36bea2b-c2da-4ac5-b1bf-26d98b1c90b3")
# Use the SDK ...
| Parameter |
Type |
Required |
Description |
trigger_id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.SDKError |
4XX, 5XX |
*/* |
List Trigger Events
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY"),
) as mistral:
res = mistral.beta.triggers.list_events(trigger_id="a4a77501-7106-45dd-ba40-61b80d862c18", limit=10)
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
trigger_id |
str |
✔️ |
N/A |
limit |
Optional[int] |
➖ |
Maximum number of events to return |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.TriggerEventList
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.SDKError |
4XX, 5XX |
*/* |