<!-- https://zerolog.ch/docs/tasks · Docs / Agents -->
# Scheduled tasks

Give an agent a job and a time. A task starts a `/goal` or `/ultracode` run on a schedule. It needs a paid plan.

*For example*

| Job | Time |
| --- | --- |
| A build | Nightly |
| A check | Daily |
| A summary | Weekly |

## Your timezone

Each task has its own **timezone**, and the schedule follows it, not the server's. The form starts with Europe/Zurich; change it to yours. Daylight saving is handled. Pick a preset (daily at 03:00, daily at 08:00, every hour, Mondays at 03:00) or type a five-field cron expression, and the form shows the next three run times before you save.

## The cap, if you set one

A schedule has **no spend cap by default**. You can set a budget on the task; a run then stops at it. Without one, a run uses credit until it ends or your credit reaches zero. See [Limits](https://zerolog.ch/docs/limits).

## The log

Every run leaves a **log you can read in the morning**: it is a job under [Jobs](https://zerolog.ch/docs/jobs), with its trace and cost. If the worker was down while a run came due, the task fires once when it is back, not once for every missed time. A task stops by itself at its maximum number of runs.

## From a schedule to a run

Mermaid source of the diagram on this page:

```mermaid
%% Scheduled tasks: from schedule to a run. Facts from server/cowork.js (nextRun, runDue, retire, startScheduler), server/routes/tasks.js, web/apps/web/app/(app)/tasks/page.tsx.
flowchart TB
  sched["You create a task:<br/>name, type (goal or ultracode),<br/>schedule, timezone<br/>optional: budget per run,<br/>maximum runs"]
  tick["The worker checks every<br/>30 seconds which tasks are due"]
  ok{"Still allowed?"}
  stop["Task is switched off:<br/>maximum runs reached,<br/>or the permission is gone"]
  job["A job is queued<br/>with your budget as spend cap"]:::hot
  jobs["The run appears under Jobs<br/>with its log and cost"]
  next["Next run time is computed<br/>in your timezone"]

  sched --> tick --> ok
  ok -->|no| stop
  ok -->|yes| job --> jobs
  job --> next
  next -.-> tick

  linkStyle 3 stroke:#8f7ac9
```
