Skip to main content

Schedules

Functions for creating, listing, and updating cron schedules that run an agent automatically. Schedules use standard 5-field cron expressions — e.g. 0 9 * * 1-5 = weekdays at 09:00.

A schedule's executeAsUser must be a user id from the organization's members. Omit it to run as the current user.


schedule-create

Create a cron schedule linked to an agent.

Input

FieldTypeRequiredDescription
agentIdstringYesAgent id to run on the schedule.
namestringYesShort label (e.g. Daily report).
cronExpressionstringYes5-field cron string (e.g. 0 9 * * 1-5).
promptstringYesTask text passed to the agent each run.
activebooleanNoWhether the schedule is active (default true).
executeAsUserstringNoOrg member user id to run as; omit for the current user.

Output

FieldTypeDescription
scheduledTriggerIdstringId of the created schedule.
scheduleNamestringThe schedule label.
agentIdstringThe linked agent id.
agentNamestring | nullThe agent's name.

schedule-list

List the scheduled triggers for an agent.

Input

FieldTypeRequiredDescription
agentIdstringYesAgent id.

Output

FieldTypeDescription
agentIdstringThe agent id.
countnumberNumber of triggers.
triggersarrayEach: \{ id, name, cronExpression, prompt (excerpt), active, executeAsUser, createdAt \}.

schedule-update

Update an existing scheduled trigger. Pass scheduledTriggerId and only the fields to change (at least one required).

Input

FieldTypeRequiredDescription
scheduledTriggerIdstringYesSchedule id (from schedule-list / schedule-create).
namestringNoNew label.
promptstringNoNew task text.
cronExpressionstringNoNew cron string.
activebooleanNoEnable/disable.
executeAsUserstring | nullNoOrg member user id, or null to clear.

Output

FieldTypeDescription
scheduledTriggerIdstringThe schedule id.
scheduleNamestring | nullThe (possibly updated) label.
agentIdstringThe linked agent id.
agentNamestring | nullThe agent's name.