Skip to main content

enterprise_ai.scheduler

Source: sdks/python/src/enterprise_ai/scheduler/__init__.py. Back to the Python SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Class SchedulesClient​

/v1/schedules.

Resource

SchedulesClient.create​

create(agent_id: str, cron: str, input: object = None, timezone: str = 'UTC', **extra: Any) -> Any

Create a schedule. Schedules runs of an agent from a cron expression evaluated in a time zone; the first next_run_at is computed (422 invalid_cron). When Temporal is configured the schedule is created there (503 scheduler_unavailable on failure). Needs tenant_admin, developer or application_owner. 404 agent_not_found. Audited as schedule.create.

Route: /v1/schedules (POST).

NameTypeDefaultRequiredDescription
agent_idstryesAgent to run (UUID or name).
cronstryesCron expression (1 to 200 characters), evaluated in timezone.
inputobjectNonenoInput given to every run started by the schedule.
timezonestr'UTC'noIANA time zone, for example Europe/Paris. Default UTC.
**extraAnynoExtra fields merged into the request body.

Returns: Any. Decoded JSON answer of the operation "Create a schedule".

Raises: ValueError, the typed errors of the transport (Errors).

SchedulesClient.delete​

delete(schedule_id: str) -> Any

Delete a schedule. Deletes the schedule; no new run is started by it. Needs tenant_admin, developer or application_owner. When the schedule is held by Temporal, it is deleted there too (503 scheduler_unavailable if Temporal cannot be reached). 404 schedule_not_found. Audited as schedule.delete.

Route: /v1/schedules/{schedule_id} (DELETE).

NameTypeDefaultRequiredDescription
schedule_idstryesIdentifier (UUID) of the schedule.

Returns: Any. Decoded JSON answer of the operation "Delete a schedule".

Raises: the typed errors of the transport (Errors).

SchedulesClient.list​

list(**page: Any) -> Any

List the schedules. Cron schedules of the tenant, oldest first, optionally for one agent. One page only.

Route: /v1/schedules (GET).

NameTypeDefaultRequiredDescription
**pageAnynoPagination options passed to the listing: limit (maximum number of items per page) and cursor (the next_cursor of the previous page). Iterating the returned page follows every cursor.

Returns: Any. Decoded JSON answer of the operation "List the schedules".

Raises: the typed errors of the transport (Errors).

SchedulesClient.update​

update(schedule_id: str, **changes: Any) -> Any

Update a schedule. Changes the cron expression, time zone, input or enabled flag. The next run time is computed again (422 invalid_cron for a bad expression or time zone) and the Temporal schedule is updated when Temporal holds it (503 scheduler_unavailable). Needs tenant_admin, developer or application_owner. Audited as schedule.update.

Route: /v1/schedules/{schedule_id} (PATCH).

NameTypeDefaultRequiredDescription
schedule_idstryesIdentifier (UUID) of the schedule.
**changesAnynoFields of the schedule to change, sent as the PATCH body.

Returns: Any. Decoded JSON answer of the operation "Update a schedule".

Raises: the typed errors of the transport (Errors).

Class TriggersClient​

/v1/triggers and /v1/events/publish (NATS subjects).

Resource

TriggersClient.create​

create(agent_id: str, subject: str, **extra: Any) -> Any

Create a trigger. Starts a run of the agent for every published event whose subject matches (NATS wildcards * and > allowed) and whose payload passes the filter. Needs tenant_admin, developer or application_owner. 422 invalid_subject or invalid_filter; 404 agent_not_found. Audited as trigger.create.

Route: /v1/triggers (POST).

NameTypeDefaultRequiredDescription
agent_idstryesAgent to run (UUID or name).
subjectstryesNATS subject to match (1 to 255 characters, wildcards * and > allowed).
**extraAnynoExtra fields merged into the request body.

Returns: Any. Decoded JSON answer of the operation "Create a trigger".

Raises: the typed errors of the transport (Errors).

TriggersClient.delete​

delete(trigger_id: str) -> Any

Delete a trigger. Deletes the event trigger; matching events no longer start runs. Needs tenant_admin, developer or application_owner. 404 trigger_not_found. Audited as trigger.delete.

Route: /v1/triggers/{trigger_id} (DELETE).

NameTypeDefaultRequiredDescription
trigger_idstryesIdentifier (UUID) of the trigger.

Returns: Any. Decoded JSON answer of the operation "Delete a trigger".

Raises: the typed errors of the transport (Errors).

TriggersClient.list​

list(**page: Any) -> Any

List the triggers. Event triggers of the tenant, oldest first: agent, subject and filter. One page only.

Route: /v1/triggers (GET).

NameTypeDefaultRequiredDescription
**pageAnynoPagination options passed to the listing: limit (maximum number of items per page) and cursor (the next_cursor of the previous page). Iterating the returned page follows every cursor.

Returns: Any. Decoded JSON answer of the operation "List the triggers".

Raises: the typed errors of the transport (Errors).

TriggersClient.publish​

publish(subject: str, payload: dict[str, Any], headers: dict[str, str] | None = None) -> Any

Publish an event. Publishes an event (202): on NATS JetStream when configured, else in the platform outbox. The current W3C trace context is added to the headers. Every trigger whose subject and filter match starts a run of its agent (idempotent per event and trigger); the answer lists them in triggered, with skipped and an error code when a run could not start. Needs tenant_admin, developer or agent. 422 invalid_subject. Audited as event.publish.

Route: /v1/events/publish (POST).

NameTypeDefaultRequiredDescription
subjectstryesSubject of the event (1 to 255 characters, valid NATS subject without wildcards), for example orders.created.
payloaddict[str, Any]yesContent of the event, any JSON value. Trigger filters read it.
headersdict[str, str] | NoneNonenoHeaders of the event, string values. The trace context is added.

Returns: Any. Decoded JSON answer of the operation "Publish an event".

Raises: the typed errors of the transport (Errors).

Functions​

validate_cron​

validate_cron(expression: str) -> bool

Check a 5 field cron expression (numbers, *, ranges, lists and steps).

NameTypeDefaultRequiredDescription
expressionstryesCron expression: minute, hour, day of month, month, day of week (0 to 7).

Returns: bool. True when every field is valid and in range, else False.