# Schedules

A schedule is something the agent does on its own at set times: "every Monday
at 08:30, send each person on the team the tasks they have this week", "on
weekdays at 18:00, tell the supervisors what is still open". Each time it comes
round, Vatio hands the agent your instruction once per person, in that person's
WhatsApp chat. The agent looks things up with its [tools](https://vatio.ai/docs/tools) and writes to
them, or writes nothing when there is nothing to say.

It is set with the [MCP](https://vatio.ai/docs/mcp)'s `set_schedule`, read with `list_schedules`
and deleted with `remove_schedule`, or in the [inbox](https://vatio.ai/docs/channels/inbox), on the
WhatsApp page under Channels. Anyone on the team, a developer or the owner can
set one. It is not part of a version of the agent: it applies on save, with no
tests, like [quiet hours](https://vatio.ai/docs/handoff#hours-when-the-agent-does-not-answer).

The `set_schedule` arguments for a weekly overview:

```json
{
  "workspace": "acme",
  "key": "weekly-overview",
  "days": "mon",
  "at": "08:30",
  "timezone": "America/Santiago",
  "to": "team",
  "event": "It is Monday morning: call week_overview for this person and send them their week, short. If they have nothing due, send nothing."
}
```

`set_schedule` creates the schedule or changes the one with that `key`; a
field left out keeps its value. To pause one without deleting it, set
`"enabled": false`. `remove_schedule` with the `key` deletes it; events it
already published still go out. Schedules are live: they run with the
version everyone has, and there is no environment to pass.

## What a schedule says

| | |
|---|---|
| `key` | Its name: lowercase letters, digits, `-` and `_`, like `weekly-overview` |
| `days` | `mon` … `sun`, a span like `mon-fri`, a list like `sat,sun`, or `all` |
| `at` | The time of day, `HH:MM`, in `timezone` |
| `timezone` | An IANA time zone, like `America/Santiago` |
| `to` | `team`: everyone on the [team](https://vatio.ai/docs/team) with a verified WhatsApp number. `developer` or `owner`: those holding that role or a higher one. Or phone numbers separated by commas, up to 50 |
| `event` | What the agent is told each time, up to 1,000 characters |
| `template` | The approved template that opens the conversation when a person's 24-hour window is closed: `name`, `language`, `params` |
| `enabled` | `false` pauses it without deleting it |

Who is on the team is read each time it runs, so someone who joins gets the
next one. Each workspace has up to 30 schedules.
`list_schedules` also returns each one's `next_run_at` and `last_run_at`. A
schedule set before for Vatio's shared number shows there with `environment`
`preview`; `remove_schedule` removes every schedule with that `key`, that one
included.

## Write the event for the agent

The event is an instruction to the agent, not the message: say what to look
up and how, and when to stay quiet. The agent writes the message in the
person's language, from what its tools return, and the tools it has are the
ones that person's role reaches ([Access](https://vatio.ai/docs/tools#access)): a `week_overview`
marked `access: supervisor` works in the chat of anyone on the team.

## When it runs

Within about a minute of `at`, Vatio publishes one [event](https://vatio.ai/docs/api/events) per
person (source `schedule`), and from there it goes out like any other: it
waits out [quiet hours](https://vatio.ai/docs/handoff#hours-when-the-agent-does-not-answer), and a
person whose 24-hour window is closed — usually the case on a Monday morning —
gets the `template`, or nothing when the schedule has none (the event fails
with `outside_window`). A run the server missed by more than an hour is
skipped rather than sent at a surprising time. Follow each run with
[`GET /events`](https://vatio.ai/docs/api/events#lists) and the [message webhooks](https://vatio.ai/docs/api/webhooks).
