> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ouraicalling.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Routines

> Scheduled tasks the Milian copilot runs for you in the background

A **Routine** is a scheduled task for the [Milian](/assistants/milian-copilot) copilot: a saved prompt that runs unattended, either on a recurring schedule or on demand, in the background — no browser tab needs to stay open. Each run produces its own Milian chat transcript, visible on the workspace **Routines** page (sidebar, next to History).

Routines give Milian the same toolset it has in chat — platform tools, automations, connected apps — so a routine can do anything a chat turn can do: summarize last week's calls and email the highlights, sweep for stalled leads and nudge them, post a daily digest, and similar unattended work.

## Schedule types

| Type         | Fires                                                                        | Fields                                    |
| ------------ | ---------------------------------------------------------------------------- | ----------------------------------------- |
| **Manual**   | Only when you (or Milian's `run_routine` tool) trigger it — never on its own | —                                         |
| **Hourly**   | Every hour, at a chosen minute                                               | Minute (0–59, default 0)                  |
| **Daily**    | Every day, at a chosen time                                                  | Time (`HH:MM`, default 09:00)             |
| **Weekdays** | Monday–Friday, at a chosen time                                              | Time                                      |
| **Weekly**   | Once a week, on a chosen day and time                                        | Weekday (`0`=Sunday … `6`=Saturday), time |
| **Custom**   | A 5-field cron expression (minute hour day-of-month month day-of-week)       | Cron expression                           |

All schedules run against a **timezone** (default your workspace timezone) — the fields above are wall-clock time in that zone, including through daylight-saving transitions. A **Custom** cron schedule must fire at least **10 minutes apart**; a tighter interval is rejected when you save it. An **Hourly** routine fires once per wall-clock hour at its chosen minute; when a daylight-saving transition skips or repeats a wall-clock time, the routine resolves to the first valid occurrence.

## Required connections

When a routine's prompt depends on a Connected app — posting to Slack, reading Gmail, writing to a CRM — Milian records which apps it needs (`slack`, `gmail`, …) on the routine. A routine **refuses to be created or updated** while one of those apps is not connected, and **refuses to run** — even on its own schedule — the moment a required connection goes missing, expires, or breaks, so it never fails silently and unattended every time it fires. The Routines page shows a warning on any enabled routine whose required connection is currently missing or broken, with a link to reconnect it.

## Creating a routine

Routines are **chat-first**: ask Milian directly — open the copilot and describe what you want scheduled and when; Milian explains how routines work, asks the questions it needs, and proposes the routine for you. On the dashboard, the small task icon next to the help icon (and the **New routine** button on the Routines page) inserts a ready-made starter prompt into the composer.

Creating, updating, or deleting a routine through chat always shows an **Approve / Cancel** confirmation card first — Milian never saves a change on its own. The card summarizes exactly what will change (name, prompt, schedule, timezone, enabled state); nothing happens until you click Approve, and Cancel discards the proposal.

## Managing a routine

The **Routines** page lists your routines and lets you edit, run, and delete them — but not create one (see above). Opening a routine there lets you change its name, prompt, schedule type and its fields, timezone, and enabled/disabled toggle. Toggling a routine off pauses it (clears its next run) without deleting it; toggling it back on recomputes the next run from the current time. **Run now** starts an off-schedule run immediately; **Delete routine** removes it for good.

## Background execution & transcripts

On schedule (or when triggered manually), a routine's prompt is sent to Milian as a durable background run — it keeps executing even if you close the browser. The run appears as a normal Milian chat thread; open it from the Routines page to read the full transcript, including which tools Milian used. Run transcripts are kept for **10 days**.

Each routine also tracks its last run's outcome (succeeded, failed, or still running) and the next scheduled run, both shown on the Routines page.

Before finishing, Milian re-checks the result of every tool the run relied on — a tool call that errored or came back empty gets retried once, and if it still fails the transcript states plainly what did not work instead of quietly claiming success. A run's status only reads Succeeded when it actually produced a result; the Routines page also flags a run's tool errors (a "N tool errors" indicator) even when its overall status is Succeeded, so you can tell a clean run apart from one where something underneath it failed.

## Billing

A routine run is billed exactly like a normal Milian chat turn — the same per-turn credit cost, deducted from your workspace balance. There is no separate "routines" charge. If your workspace doesn't have enough credit balance when a run is due, the run fails with an insufficient-credits error and the routine reschedules for its next occurrence.

## Plan limits

The number of routines a workspace can have is a plan limit (`-1` = unlimited, `0` = the feature is off for that plan). Creating a routine past the limit is rejected until you delete one or upgrade.

## API & MCP

Everything above is available in the [public REST API](/api-reference/introduction) and as MCP tools at `https://<your-domain>/mcp`:

| REST                                     | MCP tool                                          | Scope                             |
| ---------------------------------------- | ------------------------------------------------- | --------------------------------- |
| `GET/POST /api/v1/routines`              | `list_routines`, `create_routine`                 | `routines:read`, `routines:write` |
| `GET/PATCH/DELETE /api/v1/routines/{id}` | `get_routine`, `update_routine`, `delete_routine` | `routines:read/write`             |
| `POST /api/v1/routines/{id}/run`         | `run_routine`                                     | `routines:write`                  |
| `GET /api/v1/routines/{id}/runs`         | `list_routine_runs`                               | `routines:read`                   |

API keys and OAuth tokens have no signed-in end user, so these endpoints act as the workspace's oldest owner member — the same actor a Milian chat turn on your own account would use when you're signed in.

## What a routine may do on its own

A routine runs unattended, so Milian cannot stop and ask you mid-run. Within a
routine it therefore proceeds on the actions your prompt implies — including
ones that spend credits or reach real people, such as placing calls, sending
messages or running a connected-app action. Treat a routine's prompt as
standing approval for exactly that work, and keep prompts narrow.

Four things stay off-limits in a routine, because no scheduled task needs them
and the damage would outlive the run: creating API keys, buying phone numbers,
changing consent mode, and changing data-retention settings. Milian will say so
and ask you to do them from a chat instead.

Be deliberate with routines that read content you do not control — inbound
email, call transcripts, web pages, records from a connected app. Instructions
hidden in that text can influence the run. Give such routines a narrow prompt
and review their transcripts.

A routine that produces a result can deliver it directly, instead of just
leaving it in its own transcript: by email, to a chat channel (Slack, Teams,
Discord, and similar), by SMS or WhatsApp, or to a webhook/external API — and
it can run a single automation action to do so without first building a whole
automation. These are real actions with real effects: an email actually sent,
a message actually posted, a request actually made.
