# Create an automation

Schedule a bot to do a job, once or on repeat. Quick create on the calendar, the full editor, every repeat option, and how to write instructions that work unattended.

Canonical page: https://themachine.myapps.ai/docs/desktop/automations/create

## Ways to start

Open **Tools → Automations**, then any of these:

- Click **New → Scheduled task** (*"Ask a bot to do something later"*).
- On the calendar, **drag across empty time** to create a routine there.
- On the calendar, **drag a bot** from the list on the left onto a time.
- Press **C** while the calendar is open.

## Quick create

![Dragging on the calendar to create a routine, filling in the quick form, and saving](/images/docs/desktop/anim-calendar-create.webp)

Dragging on the calendar, or pressing **C**, opens a small form,
**New calendar event**:

1. **Add title**: a name, like *Morning briefing*.
2. The date and time come from where you clicked. Change them if needed.
3. **Assign a bot**: choose who does it.
4. **What should the bot do?**: the instructions.
5. **Post results to**: the thread where results land. It starts on the bot's
   main thread. See [Where results go](#where-results-go).
6. Click **Save**.

Quick create makes a **one-off** run. For a repeating schedule, click **More
options** to open the full editor.

## The full editor

![The routine editor filled in for a weekday morning briefing](/images/docs/desktop/routine-editor.webp)

**New → Scheduled task**, or **More options** from quick create, opens **New
event**:

| Field | What to enter |
|---|---|
| **Title** | A name you'll recognize, like *Competitor news*. |
| **Starts** | The date and time of the first run. |
| **Repeat** | How often. See [Repeat options](#repeat-options). |
| **Assign a bot** | One bot. It does every run. |
| **Post results to** | The thread where each run's results land. Starts on the bot's main thread. See [Where results go](#where-results-go). |
| **Remember the last run** | A tick box, shown when results don't go to an existing thread. See [Remember the last run](#remember-the-last-run). |
| **Instructions** | What the bot should do. Required. See [Write good instructions](#write-good-instructions). |

A box explains that the routine **runs in the cloud**, on the bot's own
computer, so your computer can be asleep or off.

Click **Schedule routine** to save.

## Repeat options

| Option | Runs |
|---|---|
| **Does not repeat** | Once, at the start time. |
| **Every X minutes** | Every 5, 10, 15, 30, or 60 minutes, or pick **Custom…** and type any whole number from 5 to 1,440. Choose which days (**Every day**, **Weekdays**, or **Custom…**) and hours (**All day**, or **Custom hours…** like 9 to 5). |
| **Daily** | Every day at the start time. |
| **Every weekday (Monday to Friday)** | Weekdays at the start time. |
| **Weekly on …** | Once a week, on the start date's weekday. |
| **Selected weekdays** | On the days you tick, like Monday, Wednesday, and Friday. |
| **Monthly** | Once a month, on a day you choose, or the **Last day** of the month. |
| **Yearly** | Once a year. |
| **Custom cron (advanced)** | Any schedule you can write as a cron expression. |

> **Pick a custom interval that fits evenly into an hour or a day**
> A custom **Every X minutes** value must divide evenly into an hour (like 20)
> or be a whole number of hours that divides evenly into a day (like 120 for
> every 2 hours, or 360 for every 6). Any other value, like 45, 90, or 1,440, is
> saved as **every hour, on the hour** instead. For a schedule like that, use
> **Daily** or **Custom cron (advanced)**.

### Custom cron

Cron is a standard way to write schedules in five fields: minute, hour, day of
month, month, and day of week. Choose a time zone too. The editor previews the
next few runs, so you can check it's right.

| Cron | Means |
|---|---|
| `0 8 * * 1-5` | 8:00am, Monday to Friday. |
| `30 17 * * 5` | 5:30pm every Friday. |
| `0 9 1 * *` | 9:00am on the 1st of every month. |
| `0 */2 * * *` | Every 2 hours, on the hour. |

If you're not sure, use one of the simpler options instead.

## Write good instructions

An automation runs without you there to answer questions, so the instructions
need to stand on their own.

- **Be complete.** Say exactly what to do, where to look, and what to produce.
- **Say what "done" looks like.** *"A summary under 300 words, with a link
  for each item."*
- **Say what to do when there's nothing to report.** *"If there's no news,
  just say 'Nothing new today.'"*
- **Say what to do when something fails.** *"If a site won't load, say which
  one at the top of your reply."*
- **Don't ask it questions.** Nobody will be there to answer.

**Example:**

```text
Check the news from the last 24 hours about Acme, Globex, and Initech.
For each company, list up to 3 important stories with a one-line summary
and a link. Ignore stock price updates.
If there's nothing important for a company, write "Nothing new."
Keep the whole thing under 300 words.
```

**Test it first.** Before scheduling, send the same instructions to the bot as
a normal message, and check you like the result. Or create the routine and use
**Run now**. See [Manage automations](/docs/desktop/automations/manage).

## Apps and secrets

If the job needs an app, like reading your calendar or a project board,
connect it first. See [Connected apps](/docs/desktop/integrations/connected-apps).
If it needs an API key, add it as a secret. See [Secrets and
webhooks](/docs/desktop/integrations/secrets-and-webhooks).

## Where results go

![The routine editor with Post results to and Remember the last run](/images/docs/desktop/routine-results.webp)

**Post results to**, under **Assign a bot**, decides where each run's results
land. The menu has:

| Choice | What happens |
|---|---|
| **One of the bot's threads** | Each run is posted into that thread, and the bot answers there. Threads are grouped by folder, with **No folder** for the rest. |
| **Create a dedicated results thread** | Results don't go into any of your existing threads. Each run starts in a new thread of its own, with fresh context. |
| **Keep current destination** | Only when you edit a routine. Leaves the destination as it is. |

**The default is the bot's main thread**: its oldest thread. So a routine reads like the bot checking in where you already talk
to it, not a stray new thread every run. If you change **Assign a bot**, the
destination moves to the new bot's main thread.

Which to choose:

- **Post into an existing thread** when the runs build on each other, like a
  daily update you reply to. The bot sees the earlier messages in that thread,
  including previous runs.
- **Create a dedicated results thread** when each run should start clean, like
  a daily check that shouldn't be swayed by yesterday's. Tick **Remember the
  last run** if you still want it to say what changed.

If a thread you picked no longer exists, the menu shows **Thread unavailable —
choose another**. Pick a different one and save. Until you do, runs still
happen, but their results can't go to the missing thread.

### Remember the last run

**Remember the last run** shows under **Post results to** when results don't
go to an existing thread. It's off unless you tick it.

When it's on, *"Each run starts with what the previous one reported, so the
bot can tell you what changed."* The bot gets the final reply from the last
run, not everything it did.

You don't need it when results go to an existing thread: the bot can already
see the last run there.

**Example:** *Check our three competitors' pricing pages and list any price
changes.* With **Remember the last run** on, the bot can answer *"Globex cut
its starter plan from $29 to $24 since yesterday"* instead of listing every
price again.

### Read the results

- Open the thread you chose, or click the routine and choose **Open results
  thread** or **Open thread**.
- Finished runs also show under **Done today** on [Today](/docs/desktop/bots/today).

Read what the bot did, ask follow-up questions, or carry on from there. See
[Manage automations](/docs/desktop/automations/manage#find-the-results).
