Tasks & Scheduling
Tracked units of work — run once, run on a cron, or run when something else finishes.
A task is work with a status, not a conversation. It has a lifecycle you can query, an owner, optional dependencies, and — when you want it — a schedule.
Create a task
Execution modes
| Mode | Behaviour |
|---|---|
single | One agent run against the description |
workflow | Runs the workflow named by workflowId, with workflowInputs |
sequential | Runs its dependencies in order, then itself |
Lifecycle
Scheduling
cronExpression uses standard five-field cron and is evaluated in UTC.
Convert local times yourself — an 8 a.m. Nairobi briefing is 0 5 * * 1-5.
| Expression | Fires |
|---|---|
0 8 * * 1-5 | 08:00 UTC, weekdays |
*/15 * * * * | Every 15 minutes |
0 0 1 * * | Midnight UTC on the 1st |
0 */6 * * * | Every six hours |
Set scheduledFor to an ISO timestamp instead of a cron expression for a
one-off future run. nextRunAt and lastRunAt on the task tell you where the
schedule stands.
reschedule moves a one-off run; change a recurring schedule with update:
Run, watch, cancel
Dependencies
A task with unmet dependencies waits rather than failing.
Constraining tools
Point a task at exactly the tools it should use:
hard refuses anything outside the list; soft treats it as a preference.
Timeouts and priority
Give long workflow tasks a timeoutMs — an unbounded task that hangs keeps
consuming credits until something stops it.
Tasks vs heartbeats
| Task | Heartbeat | |
|---|---|---|
| Scope | One defined job | Whatever the agent decides |
| Schedule | Cron or timestamp | Fixed interval |
| Result | Stored on the task | A run in a session |
| Good for | "Send the Monday report" | "Keep an eye on the queue" |
Reach for a task first. A heartbeat is the right tool only when the work is genuinely open-ended.
Agents creating tasks
Give an agent createTask and updateTaskProgress and it can queue its own
follow-up work:
