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
executeAsUsermust 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
| Field | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | Agent id to run on the schedule. |
name | string | Yes | Short label (e.g. Daily report). |
cronExpression | string | Yes | 5-field cron string (e.g. 0 9 * * 1-5). |
prompt | string | Yes | Task text passed to the agent each run. |
active | boolean | No | Whether the schedule is active (default true). |
executeAsUser | string | No | Org member user id to run as; omit for the current user. |
Output
| Field | Type | Description |
|---|---|---|
scheduledTriggerId | string | Id of the created schedule. |
scheduleName | string | The schedule label. |
agentId | string | The linked agent id. |
agentName | string | null | The agent's name. |
schedule-list
List the scheduled triggers for an agent.
Input
| Field | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | Agent id. |
Output
| Field | Type | Description |
|---|---|---|
agentId | string | The agent id. |
count | number | Number of triggers. |
triggers | array | Each: \{ 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
| Field | Type | Required | Description |
|---|---|---|---|
scheduledTriggerId | string | Yes | Schedule id (from schedule-list / schedule-create). |
name | string | No | New label. |
prompt | string | No | New task text. |
cronExpression | string | No | New cron string. |
active | boolean | No | Enable/disable. |
executeAsUser | string | null | No | Org member user id, or null to clear. |
Output
| Field | Type | Description |
|---|---|---|
scheduledTriggerId | string | The schedule id. |
scheduleName | string | null | The (possibly updated) label. |
agentId | string | The linked agent id. |
agentName | string | null | The agent's name. |