# Automations Run a chain of steps on a schedule, from a webhook or on demand, with the assistant, your connectors, jobs and workspaces. An **automation** is a saved chain of steps that PrivateMind runs for you on a schedule, when a webhook is called, or when you click **Run**. A step can have the assistant work through a prompt with your connectors, call an API, send a notification, run a job or start a workspace. Use one for work you would otherwise repeat by hand, such as a weekday news digest or a nightly data pull. Open **Automations** in the app navigation, or go to `/automations`. Your organisation needs **Automations** turned on in [org settings](https://docs.privatemind.com/org-settings.html). If it's off, the page says so. ## Creating an automation There are three ways to start: - **Describe it.** Type what you want under **Describe what you want to automate**, for example "Every weekday at 7am, find the top tech news using web search and notify me in-app". The builder opens and the AI drafts the steps. Nothing is saved until you click **Save**. - **Use a template** from the **Templates** tab. Replace its placeholders, such as `{{YOUR TOPIC HERE}}`, before you save: a placeholder left in is sent to the agent as it is, and the builder asks before saving one. - **Build it by hand** with **New Automation**. In the builder, add steps from the palette, set each one up and choose a trigger. **Edit with AI** asks the AI to change the flow for you. **Save** keeps it and **Run** starts a run straight away. **Run** works once the automation is saved, with no unsaved changes and no step errors. You can save an automation that still has step errors. It's listed as **Draft**, and nothing runs it until you fix the errors and save again. If you save changes while a run is in progress, that run finishes with the steps it started with, and your changes apply from the next run. ## Steps | Step | What it does | | --- | --- | | **Run Agent** | Has the assistant work through a prompt with tools and the connectors you attach. See [Agent steps](https://docs.privatemind.com/cloud-agents.html#agent-steps). | | **Condition** | Compares a field of the previous output (equals, contains, greater than and so on) and picks the next step. | | **Call API** | Sends a `GET`, `POST`, `PUT`, `PATCH` or `DELETE` request with headers and a body. | | **Transform Data** | Extracts a field, joins a list, fills in a template, parses JSON or counts items. | | **Send Notification** | Sends a message in the app or to a webhook URL. | | **Wait** | Pauses for a number of seconds, minutes or hours. Keep it under 30 minutes: a run that shows no progress for 30 minutes is marked **Failed** and the failure notice goes out. | | **Run Job** | Runs a command in a workspace image. See [Run Job steps](https://docs.privatemind.com/cloud-agents.html#run-job-steps). | | **Workspace** | Starts or stops a workspace. See [Workspace steps](https://docs.privatemind.com/cloud-agents.html#workspace-steps). | Steps hand data to each other through tokens, which are filled in when the step runs. The `{{ }}` button next to a field (**Insert variable**) lists the previous step's output and each earlier step's. - `{{prev.output}}`: the previous step's output. - `{{steps..output}}`: an earlier step's output, by its output variable or its step ID. - `{{vars.}}`: one of the automation's variables, which the AI builder sets up. - `{{trigger.}}`: a field from the webhook request that started the run. A token that matches nothing becomes empty text. ## Agent steps A **Run Agent** step gives the assistant a prompt and lets it use tools, as it does in chat, until it has an answer. Each time the step runs it opens a new conversation, titled "Agent:" and the start of the prompt. You set: - **Prompt**: what the agent should do. - **Model**: **Default (org setting)** or one of your organisation's chat models. Agent steps can't use a third-party provider's model, even if your organisation has turned one on: the step fails. If a step names a model your organisation no longer offers, the automation becomes a Draft until you pick another. - **Connectors**: what the agent may query. The person running the automation must have access to each one. If they don't, a run started by hand is refused, and a scheduled or webhook run fails at this step. Either way the message names the connector. - **Enable web search**: lets the agent search the web, if your organisation allows web search. - **Max iterations**: how many model turns the agent gets, 25 by default and at most 50. If it uses them all without finishing, the step fails. - **Timeout (min)**: how long the step may run, 5 minutes by default. A step that runs out of time fails. The agent can also use the [skills](https://docs.privatemind.com/skills.html) the person running the automation has turned on, when your organisation has skills and code execution on. Nobody is there to answer during a run, so the agent can't ask questions or wait for approval. A tool can need approval because of that person's **Tool Call Approvals** settings, or because your organisation requires approval for every tool call. In a run, such a tool counts as switched off and the agent carries on without it. If an agent step reads a private connector such as [Microsoft 365](https://docs.privatemind.com/microsoft-365.html#attaching-it-changes-the-conversation), it can't also use web search or a connector that reaches the internet. The step fails with an error that names what to remove. The check covers that one step. A later **Call API** or **Send Notification** step sends whatever you put in it, so don't pass a private connector's results to an outside address. ## Scheduled automations An automation starts on a schedule, on an interval, from a webhook or by hand. Pick the trigger in the builder: - **Schedule**: hourly, daily, weekly or monthly at a time you choose, or a five-field cron expression under **Edit raw cron expression**. A monthly schedule skips months without that day, so day 31 doesn't run in February. - **Interval**: every so many minutes, hours or days, and at least 5 minutes. - **Webhook**: see [Webhook triggers](https://docs.privatemind.com/cloud-agents.html#webhook-triggers). - **Manual**: runs only when someone clicks **Run** or **Run Now**. A cron expression is written with numbers, `*`, ranges, lists and steps, such as `0 9 * * 1-5`. Names such as `MON` aren't accepted, and Sunday is `0`. Keep a schedule at least 5 minutes apart. A schedule runs in the timezone saved with it. The **Timezone** box shows your browser's timezone before you set one, but saves it only once you edit the box. With no timezone saved, or a name PrivateMind doesn't recognise, the schedule runs in UTC. Type the exact name, such as `Europe/London` or `America/New_York`, before you save. ## Webhook triggers A **Webhook** trigger lets another system start a run by sending a `POST` to the automation's URL. When you save, the builder shows the URL and a **signing secret**. Copy the secret then: it's shown once and can't be retrieved later. If you change the trigger away from **Webhook** and save, that URL and secret stop working for good. Switching back to **Webhook** and saving gives a new URL and secret, which is also how you replace a secret. Only the owner can do this. Each request needs: - `Content-Type: application/json`. - `X-Webhook-Timestamp`: the time in Unix seconds. A request more than 5 minutes old is rejected. - `X-Webhook-Signature`: `sha256=` followed by the hex HMAC-SHA256 of `{timestamp}.{body}`, keyed with the signing secret. The JSON body becomes the first step's input, and its fields are available as `{{trigger.}}`. A body over 100 KB is refused with `413` and no run starts. Once the automation is saved, **Send test payload** in the builder starts a run with a test body you write. | Response | Meaning | | --- | --- | | `200` | The run started. Its ID is in `total.runId`. | | `400` | The automation has step errors. | | `401` | A signature header is missing or wrong, or the timestamp is outside 5 minutes. | | `403` | Automations is turned off for your organisation. | | `404` | No such webhook, or the automation is paused. | | `409` | A request with the same timestamp and body was already accepted. To retry after a network error or a `5xx`, sign it again with a new timestamp. | | `413` | The body is over 100 KB. | | `429` | Too many requests. Wait for the time in `Retry-After`. | ## Run Job steps A **Run Job** step runs one shell command in a workspace image on a home volume, such as a nightly data pull. [Workspace jobs](https://docs.privatemind.com/sdk-jobs.html) explains what a job is and what it can do. The run submits the job and waits for it, even through a platform restart, then passes the job's exit code and the end of its output to the next step. If the job fails, the run fails with the reason and the last lines of the output. To run a single job on a schedule, schedule it from the Jobs tab instead; see [On a schedule](https://docs.privatemind.com/sdk-jobs.html#on-a-schedule). ## Workspace steps A **Workspace** step starts or stops one of your [workspaces](https://docs.privatemind.com/workspaces.html#stop-and-start-without-the-browser). For example, one automation can start a GPU workspace for the working day and another can stop it in the evening, which gives its GPU back. - A start waits until the workspace is up before the next step runs, unless you untick **Wait until it is up**. - If the workspace isn't up within 15 minutes, the step fails and the workspace carries on starting. - If it can't start at all, for example because no GPU is free, the run fails with that reason. The step acts as the user the run bills, so it can start or stop only what that user could from the Workspaces page. Its output is the workspace's `name`, the `action` and the `phase` it reached. ## Runs and the step log The list shows each automation's last run: **Completed**, **Failed**, **Running**, **Queued**, **Cancelled**, **Warnings** or **Never run**. **Warnings** means the run finished but a step did not end cleanly, such as a Call API step that got an error response. Runs in progress are also listed separately, each with **Cancel**. Click an automation to see the output of its latest run and its **28 day run history**. Open a run to follow it step by step: **Flow** shows each step's result, and **Timeline** is the step log, every event the run recorded, in order. Log events are deleted after 30 days, and the timeline shows at most 1,000 events per run. An agent step's conversation opens from its run, with **Continue as Chat** on the latest output or the conversation link in the timeline. These conversations aren't listed in the chat sidebar or on the Chats page. When a step fails, you can: - **Retry this step**, or **Skip and continue** past it. A Condition step, or a step with nothing after it, can only be retried. - **Continue from where it stopped**, when the run ended before every step ran. - **Debug with AI**, which hands the failure to the AI builder to suggest a fix. This needs edit access. Retry, skip and continue need edit access, or that you started the run. Each one starts a new run and keeps the failed one. When a run fails, the person it bills gets a notification in the app, and the owner gets an email, at most one an hour for each automation. ## Sharing If your organisation allows it, the owner can **Share** an automation with a colleague or publish it to the whole organisation. An org admin allows each one in [org settings](https://docs.privatemind.com/org-settings.html) with **Share automations with colleagues** and **Publish automations to the org**. Both are off until then. There are three levels: | Level | What they can do | | --- | --- | | **View** | See it and its runs, and duplicate it. | | **Run** | Also run it. | | **Edit** | Also change its steps, schedule and trigger. | View and Run see each run's status and timing, and the Timeline shows them the start of each step's result. Edit sees everything, including what your connectors returned. Shared automations appear on the **Shared with me** tab. Anyone who can see one can **Duplicate** it into their own list. The copy is theirs. It starts paused, and a webhook trigger becomes **Manual** until they set it up again. A run that someone other than the owner starts is billed to them and uses their access to connectors. An automation that uses a personal connector such as Microsoft 365 can't be shared, because the connector reads as whoever runs it. An org admin has the same access as the owner to every automation in your organisation, so they can change, run, share or delete any of them. Otherwise only the owner can share or delete. ## Limits and cost By default: - You can have up to 20 automations. - Up to 5 agent steps billed to you can run at once, across every automation you run. Over the limit, a run started by hand is refused and a step fails, both with "Maximum of 5 concurrent agents per user exceeded". Model use in a run counts against the [budget](https://docs.privatemind.com/budgets-and-limits.html) of the person the run bills: the owner for scheduled and webhook runs, and otherwise whoever started it with **Run**, **Run Now**, **Send test payload** or a retry. ## Pausing, stopping and deleting - **Pause**: turn off the automation's **Active** switch. A paused automation doesn't run on its schedule and its webhook answers `404`, but you can still run it by hand. Turn the switch back on to resume. - **Stop a run**: click **Cancel** on a run in progress, or choose **Cancel run** from the automation's menu. The run is marked **Cancelled**, and a job it's waiting on is stopped. An agent step that's already working carries on in the background until it finishes or reaches its timeout or iteration limit, and its model use still counts against the budget. - **Delete**: choose **Delete** from the automation's menu. It deletes the automation and its run history permanently. The conversations its agent steps opened stay stored, and once the runs are gone nothing in the app links to them. ## Where next - [Workspace jobs](https://docs.privatemind.com/sdk-jobs.html): what a Run Job step runs - [Workspaces](https://docs.privatemind.com/workspaces.html): what a Workspace step starts and stops - [Connectors](https://docs.privatemind.com/connectors.html): connecting the sources an agent step reads - [Budgets and limits](https://docs.privatemind.com/budgets-and-limits.html): where the cost of runs shows up