Run a workflow on a schedule or event
Make a saved workflow start on its own: at set times, every so often, whenever its playbook records an event, or when something happens in an app you have connected.
Before you start
- Your agent is connected to Auto. The quick start sets this up. Hosted Auto keeps scheduled work running after you close your agent.
- You have a playbook with a saved workflow that does the work, and it succeeds when your agent runs it. Workflow format describes the document.
- To start a workflow on an event, you know which event. An event is a record that something happened, such as a brief being submitted. It may be one your systems publish to the playbook, or one of the playbook's own, such as a function's run succeeding.
- To start a workflow from an app, the app is connected to your organization and available to the playbook.
Decide how the workflow starts
Schedule or event
A trigger is part of the workflow's document, under schedule. There are three kinds:
| Trigger | Starts a run | Use it for |
|---|---|---|
cron | At the times its five fields name, in its time zone | Fixed times, such as 09:00 every Monday |
every | Once every period, counted from when it was saved | A steady pace, such as every 15 minutes |
on | For each event of the playbook that its filter matches | Work that follows an event, such as a brief being submitted |
A workflow may have one trigger of each kind, and each starts its own runs. Your agent can still run the workflow itself.
cronreads five fields: minute, hour, day of month, month and day of week.'0 9 * * 1'is minute 0 of hour 9 on Mondays. When both day of month and day of week are restricted, a day that matches either is due.time_zonebesidecronnames the time zone its times are in, by its IANA name, such asAmerica/New_YorkorEurope/London. The times then follow the clocks there through daylight saving:cron: '0 9 * * 1'withtime_zone: America/New_Yorkis 09:00 in New York every Monday, summer and winter. Withouttime_zone, the times are in UTC.- When the clocks go forward, a time they skip runs once, at the first moment after the skip. When they go back, a time they show twice runs once, the first time.
time_zonegoes withcrononly.everycounts a period, which has no time zone.everytakes a duration of at least a minute, such asPT15M(15 minutes) orPT1H(one hour). Its times are counted from when the trigger was saved.
What a triggered run gets
No trigger has an input of its own. A run that a schedule starts gets only { "schedule": { "due": "<time>" } }, and a run that an event starts gets a list holding the event. Neither gets the input your agent passes, and the workflow's input schema, which checks what your agent passes, does not check what a trigger gives. So decide where the workflow's data comes from:
- A workflow on a schedule must find its input on its own. Step 1 below sets that up before you add the schedule.
- A workflow started by an event takes its data from the event.
input.fromshapes the run's input before the first step. - A workflow that your agent also runs tells the two apart in
input.from, as steps 1 and 6 show.
A run that a trigger starts acts as the playbook. Its started_by names the playbook: the id is playbook: followed by the playbook's id, and the name is the playbook's id. The run's steps can read and write that playbook and nothing else. Its separate acts_for field identifies the person who saved or restored the workflow version, where that person still belongs to the organization; it adds no permissions. When a trigger applies gives the identity rules. The run is kept in the playbook's history like any other run.
Overlap and cost
- A schedule has one run at a time. A time that falls due while its previous run still runs is skipped.
- Each run counts toward usage, and so does each run of a function or workflow that one of its steps calls. On hosted Auto, runs use your organization's credits, and so do the model calls they make; Pricing explains what each costs.
- Each run may also send requests to people. Test with a short schedule, and replace it once it has started a run.
- When a usage limit stops a run that a trigger would start, such as once the organization's credits are spent, or while a self-hosted runtime can't use its license, that run never starts and is not tried again.
- Event triggers have limits on how many runs they start, how many filters they take and how long a chain of runs may grow. Trigger limits lists them.
What a trigger did not start is recorded as a reaction_refused event of the workflow, which list_playbook_events shows.
Add a schedule
1. Give the workflow its input
A run that a schedule starts gets only the time it was due. A workflow that needs a campaign, a brief or a date range would start without it, and the first step that needs the value would fail. So before you add a schedule, make the workflow get its input on its own. There are three ways:
| Way | How it works | Good when |
|---|---|---|
| Fill in the input | The workflow's input.from puts fixed values in place of the schedule's input. Any other input passes through, so your agent can still run it as before | The workflow runs with the same input each time |
| Add a small scheduled workflow | A new workflow holds the input and runs yours with it. The schedule goes on the new workflow, with its own page, and yours stays as it is | You want to leave the workflow unchanged |
| Read the data when it runs | A step reads back what earlier runs kept, with a lookup of their runs, or reads the data through a function's tools | The data changes between runs |
Ask your agent:
In my "<playbook name>" playbook, I want the "<workflow name>" workflow to run
on a schedule with this input: <the input it needs>. A scheduled run gets only
the time it was due. Either have the workflow fill in that input when a
schedule starts it, or prepare a small workflow that runs it with that input;
if its input schema requires a field the schedule's input lacks, prepare the
small workflow, with a page that shows what each of its runs did. Tell me which
you chose, and show me the document before saving it.For example, a workflow that takes a campaign can fill in a fixed one when a schedule starts it. If the workflow already has an input schema, and that schema requires no field the schedule's input lacks, from goes beside its schema:
input:
from: '${ $data.schedule ? { campaign: "autumn-reporting-trial" } : $data }'A workflow whose input schema requires a field the schedule's input lacks takes a small scheduled workflow instead. The schema checks the input of every run that your agent or another workflow starts. The test in step 2 gives the schedule's input, so the schema would refuse it before it starts. The small workflow's call gives the fields the schema requires, so it passes. Example: review a standing brief every Monday shows a small scheduled workflow.
2. Test it with a schedule's input
Before you turn on a schedule, run the workflow once with the input a schedule would give it. If you added a small scheduled workflow, run that one instead. Its call of your workflow is checked against your workflow's input schema, just as it will be each time the schedule starts the small workflow. Ask:
Run the "<workflow name>" workflow in my "<playbook name>" playbook with the
input {"schedule": {"due": "2026-10-19T09:00:00Z"}}, as a schedule would start
it. Show me its status and its output.Check that the run ends succeeded, with the output you expect from the input you chose in step 1. If it is rejected, or its output is built from missing values, go back to step 1: a schedule would start it the same way.
3. Test with a one-minute schedule
Before you set the real time, test the trigger with one that fires every minute. Add it to the workflow you tested in step 2. Ask your agent:
In my "<playbook name>" playbook, add a schedule to the "<workflow name>"
workflow that starts it every minute (every: PT1M). Keep everything else and
raise its version number. Show me the document before saving it, then show me
the saved version and its triggers.The document gains these lines:
schedule:
every: PT1MThe agent saves it with update_definition. Check that the saved workflow shows one trigger, with the kind every, the place /schedule/every and milliseconds: 60000, which is one minute.
4. Check the run it starts
Wait a minute, then ask:
List the workflow runs of my "<playbook name>" playbook. For the newest run of
the "<workflow name>" workflow, show who started it, its status and its history.Check that:
- the run was started by the playbook itself: the
idof itsstarted_byisplaybook:followed by your playbook's id; - the first event of its history,
run_started, readsA run of the workflow “<name>” was started by its every schedule., with the name your workflow is saved under; - it ended as the test in step 2 did, with the output you expect.
While that run still runs, the trigger starts no other. The playbook records each time it skips as a reaction_refused event.
5. Set the real schedule
Ask:
Update the "<workflow name>" workflow: replace its one-minute schedule with a
cron schedule that starts it at <the time and days, such as 09:00 every Monday,
New York time>. Name the time zone with time_zone, and raise its version
number. Show me the document before saving it, then the saved version and its
triggers.Check that the saved workflow shows one trigger, with the kind cron, the place /schedule/cron, an expression for your time and your time zone as time_zone. Schedule or event explains the five fields. The every trigger is gone, so it starts no more runs. Auto does not list the times ahead, so the agent works out the next one from the expression.
Then cancel the test runs that still wait:
Cancel the runs of the "<workflow name>" workflow that are still waiting, with
the reason "Test of the one-minute trigger".Check that each ends rejected with the reason cancelled, and so do the runs it started.
Start on an event
6. Add an event filter
An event filter names the event's type, the name of what happened, written out in full. For example, a workflow that should start each time your campaign tool publishes a com.acme.campaigns.brief-submitted event gains these lines:
schedule:
on:
one:
with: { type: com.acme.campaigns.brief-submitted }
input:
from: '${ Array.isArray($data) ? $data[0].data : $data }'If the workflow already has an input, from goes beside its schema.
- A filter can also name other attributes of the event, such as
sourceorsubject, and test its data with an expression, such asdata: '${ $data.priority === "high" }'.on.anytakes a list of filters, and a run starts when any of them matches. input.fromtakes the first event'sdatawhen an event started the run. Any other input, such as the one your agent passes, is used as it is.
Ask your agent:
In my "<playbook name>" playbook, update the "<workflow name>" workflow so that
it starts on each event of the type <event type>. When an event starts it, it
should take the event's data as its input (with input.from). Keep everything
else and raise its version number. Show me the document before saving it, then
the saved version and its triggers.Check that the saved workflow shows a trigger with the kind event, the place /schedule/on and your filter.
7. Publish a test event
Ask:
Publish a test event to my "<playbook name>" playbook, with the type <event
type>, the source <where it comes from, such as /campaigns> and this data:
<data>. Then show me the newest run of the "<workflow name>" workflow and its
history.Check that:
- the agent reports the event's
id,timeandrecorded_at; - a new run appears within a few seconds, started by the playbook itself (the
idof itsstarted_byisplaybook:followed by your playbook's id); - the first event of its history,
run_started, readsA run of the workflow “<name>” was started by its event trigger.
A filter matches more than published events. It also matches an event another workflow emits, or one of the playbook's own facts, such as run_succeeded with the subject reasoning/<name> when that function's run succeeds. Events recorded before the trigger was saved never start it.
Publishing an event again, and from other systems
An event's id and source together name it:
- Publishing the same event again, with the same
source,idand data, records nothing more and starts no second run. - The same
sourceandidwith other data is refused as a conflict. - Leave out
idto record a new event each time; Auto then makes one.
Other systems publish events over HTTP with POST /v1/orgs/{org}/playbooks/{playbook}/events, using a key that may write to the playbook. Publishing events lists the attributes and limits of an event.
Start from a connected app
A workflow can also start when something happens in an app your organization has connected, such as an issue being created in Linear. The trigger is the same schedule.on as in step 6. Its filter names the app's connection as the event's source.
With some apps, the workflow starts right away. With others, Auto checks the app about once a minute and starts the workflow for anything new. To find out which kind your app is, ask your agent how soon the workflow will start.
8. Pick the app and the event
Ask your agent:
Start my "<workflow name>" workflow whenever <what happens, such as an issue
is created> in <app>, in <the place, such as the Engineering team>.Your agent finds the event that fits, asks for anything you left out, and says back in one sentence what will start the workflow. It saves when you say yes.
The document gains lines such as these:
schedule:
on:
one:
with:
source: /connections/linear
type: app.linear.issue.created
subject: Engineering
input:
from: '${ Array.isArray($data) ? $data[0].data : $data }'sourceis the connection andtypeis the event. The agent takes both from the list of your connections.subjectis the place to watch, such as one team, repository or channel. Some events need one, and the save says so.dataadds a condition on what happened, as in step 6.
The run's input is a list holding the event, as for any event trigger. The event's data is what the app reported, such as the issue's title, and input.from takes it as the run's input.
These rules decide what starts a run:
- Only what happens after the trigger is saved starts a run. What was already in the app starts nothing.
- Things done by another app or a bot don't start a run, unless you ask your agent to include them.
- Things done by the account the app is connected with don't start a run, unless you ask your agent to include them. If the app is connected with your own account, that covers what you do in the app yourself.
- Some events don't say who did the thing. For those, the two rules above can't apply, and what anyone does starts a run.
- Take care with a workflow that itself does the thing that starts it, such as one that starts on updated issues and updates the issue. If you included that account, or the event doesn't say who did it, each run would start the next one.
- A "created or updated" event comes again every time the item changes. A workflow that posts or sends something would do it again.
9. Test it
Ask:
Test my "<workflow name>" workflow with a sample <event, such as a new issue>
from <app>.Check that the run ends succeeded with the output you expect. Then have the real thing done once in the app. If the app is connected with your own account, ask a colleague to do it. Then ask:
Show me the latest run of my "<workflow name>" workflow and what started it.Check that:
- a new run appears, started by the playbook itself, as in step 7. If Auto checks your app, the run appears after the next check;
- the first event of its history,
run_started, readsA run of the workflow “<name>” was started by its event trigger.
10. Have Auto check an app that reports no events
A connection may report no events at all. Auto can then check the app itself, about once a minute. It runs one of the connection's tools that lists things, and starts the workflow for each new one. Ask:
Start my "<workflow name>" workflow for each new <thing, such as a booking>
in <app>.- The agent names the event itself, such as
booking.created. Each run gets one item, as the tool lists it, as the event'sdata. - The first check starts nothing. The workflow starts for what is new after it.
- A workflow that changes the thing it watches starts again for its own change. Don't have it change what it reads.
- If no tool of the connection can list what is new, the agent says so. Start the workflow at a set time each day instead, as in step 5.
11. Check that the trigger is working
In Auto Studio, the workflow's page says what starts it. Where Auto checks the app, it also says how often, such as "Checked every minute". If the app is not starting runs, a line at the top of the page says why and what to do next.
Your agent can tell you the same. Ask:
Is my "<workflow name>" workflow still starting from <app>? If not, why?The agent reads the workflow with get_definition. It tells you whether the app is starting runs and how soon the workflow starts. If the app is not starting runs, it tells you why and whether the app needs reconnecting.
Show the runs on a page
12. Check the workflow's page
A run that a trigger starts does its work while you are away, so the workflow's page is how you see what it did: the outcome of each run as a headline with its key figures, and the main number of each period. Auto Studio, a chat and your agent all show the same page. A workflow's page is written with its document; if yours has none yet, this step gives it one. Ask:
In my "<playbook name>" playbook, show me the page of the "<workflow name>"
workflow. If it has none, give it one: a headline for each run that says what
it achieved, with its key figures, and a chart of <the main figure, such as
the revenue of each month> over time. If a run is about a period, such as the
month it closes, take the period from its output rather than from when it ran.The page is the page key of the workflow's document, saved with the rest of it. Its page in the workflow format says what a workflow's page shows, and A minimal page explains why a run that is about a period takes its period from its output: runs made in one sitting, or late, still land on the periods they are about. Check that:
- the newest run of the workflow shows the headline you asked for, in Auto Studio or when your agent reads the run;
- the workflow shows the chart, with a point for each period its runs covered, in Auto Studio or when your agent reads the workflow.
A new page builds its chart from the playbook's history, so the runs from before it was saved are on it too.
Stop a trigger
13. Save a version without it
To stop a trigger, save a new version of the workflow without it:
- Remove
schedule.on,schedule.cronorschedule.everyto stop that one trigger, andschedule.time_zonewithschedule.cron. A trigger the new version leaves unchanged goes on as it was. - Remove
schedulealtogether, or retire the workflow, to stop every trigger.
For example, ask:
Update the "<workflow name>" workflow: remove its schedule, keep everything
else, and raise its version number. Then show me its triggers.Check that the saved workflow shows no triggers. A stopped trigger starts nothing more, but the runs it already started go on. Cancel any that still wait, as in step 5.
A trigger you change or add applies from the version that saves it, never to anything recorded earlier. A changed schedule counts its times from then.
14. Pause the workflow for a while
To stop every trigger for a while and keep the workflow as it is, pause it, and resume it when it should run again:
Pause the "<workflow name>" workflow, because <why>. Then show me how it stands.Check that it shows status: paused, with who paused it, when and why. While it is paused, its schedule and its event trigger start nothing, and nobody can run it by hand or from another workflow; the runs already going finish. Resuming it makes up nothing it missed: its next run comes at the first scheduled time or matching event after the resume.
Example: review each submitted brief
This workflow starts each time the campaign tool publishes a com.acme.campaigns.brief-submitted event with the brief in its data. Your agent can also run it with the input {"brief": "..."}. It passes the brief to review-campaign-brief, a reasoning function in the same playbook that takes a brief. A workflow names a function by the name it is saved under. Its page heads each run with the review, and charts the briefs reviewed each day.
The workflow's namespace is the id of the "Marketing" playbook it is saved in, marketing; your agent fills in your own.
The "Review submitted brief" workflow
document:
dsl: '1.0.3'
namespace: marketing
name: review-submitted-brief
version: '1.0.0'
summary: Reviews a campaign brief. Starts by itself when a brief is submitted.
schedule:
on:
one:
with: { type: com.acme.campaigns.brief-submitted }
input:
schema:
document:
type: object
properties:
brief: { type: string }
required: [brief]
from: '${ Array.isArray($data) ? $data[0].data : $data }'
do:
- review:
call: run_definition
with:
type: reasoning
name: review-campaign-brief
input:
brief: ${ $data.brief }
page:
data:
language: typescript
source:
events:
- type: run_succeeded
subject: workflow/review-submitted-brief
views:
reviewed: series
module: |
export function fold(view: View, event: Event): View {
const day = event.time?.slice(0, 10);
if (day === undefined) return view;
const points = view.reviewed?.lines[0]?.points ?? [];
const last = points.at(-1);
const at = last !== undefined && last.at > day ? last.at : day;
const counted = last?.at === at ? [...points.slice(0, -1), { at, value: last.value + 1 }] : [...points, { at, value: 1 }];
return { reviewed: { unit: 'briefs', period: 'day', lines: [{ name: 'Briefs reviewed', points: counted.slice(-90) }] } };
}
result: |
{% if run.status == "started" %}
Reviewing the brief…
{% else %}
{{ output | clip: 2000 }}
{% endif %}
runs: |
```chart line
{{ views.reviewed | json }}
```To test it, ask your agent:
Publish a test event to my "Marketing" playbook, as the campaign tool would,
with the source /campaigns, the type com.acme.campaigns.brief-submitted and this data:
{"brief": "Campaign: Winter webinar series\nAudience: Businesses that need better reporting\nOffer: Two live webinars\nChannel: Email to our customer list\nTotal budget: USD 4,000\nSuccess measure: Generate interest in the product"}
Then show me the newest run of the "Review submitted brief" workflow and its output.A run of the workflow starts within a few seconds, and its output is the review.
Example: review a standing brief every Monday
An always-on campaign runs from one brief, and its owner wants it reviewed every Monday. The "Review submitted brief" workflow above reviews the brief it is given, but a scheduled run would give it none. So this small workflow, saved as weekly-brief-check in the same playbook, holds the brief and runs "Review submitted brief" with it. Its page heads each run with that week's review, and lists the reviews of the last twelve Mondays.
The "Weekly brief check" workflow
document:
dsl: '1.0.3'
namespace: marketing
name: weekly-brief-check
version: '1.0.0'
summary: Every Monday at 09:00 London time, runs the review of the always-on campaign's brief.
schedule:
cron: '0 9 * * 1'
time_zone: Europe/London
do:
- review:
call: run_definition
with:
type: workflow
name: review-submitted-brief
input:
brief: |
Campaign: Always-on reporting trial
Audience: Finance directors at UK manufacturing companies with 50 to 250 employees
Offer: A 30-day trial
Channel: Paid LinkedIn ads
Total budget: USD 8,000
Success measure: 100 trial registrations
page:
data:
language: typescript
source:
events:
- type: run_succeeded
subject: workflow/weekly-brief-check
views:
weeks: table
module: |
export function fold(view: View, event: Event): View {
const fieldOf = (value: Json | undefined, name: string): Json | undefined =>
typeof value === 'object' && value !== null && !Array.isArray(value) ? value[name] : undefined;
const review = fieldOf(event.data, 'output');
const day = event.time?.slice(0, 10);
if (typeof review !== 'string' || day === undefined) return view;
const rows = [[day, review.slice(0, 500)], ...(view.weeks?.rows ?? [])].slice(0, 12);
return { weeks: { columns: [{ name: 'Monday' }, { name: 'Review' }], rows } };
}
result: |
{% if run.status == "started" %}
Reviewing this week's brief…
{% else %}
{{ output | clip: 2000 }}
{% endif %}
runs: |
```chart table
{{ views.weeks | json }}
```cron: '0 9 * * 1'withtime_zone: Europe/Londonstarts a run at 09:00 London time every Monday, in summer and in winter. To test it, save it first withoutscheduleand run it with a schedule's input, as in step 2. Then putevery: PT1Min place of thecronandtime_zonelines, as in step 3.- The run's input is the due time, which the step does not read.
type: workflowruns the other workflow, and the|keeps the brief's lines as written. - The run's output is the review. The run of "Review submitted brief" that it starts acts as the playbook too.
If something goes wrong
- No run at the time you expected. Check that the schedule names your
time_zone, since without one its times are in UTC, and that Auto was running then. A time that falls due while the trigger's previous run still runs is skipped. After Auto was stopped, only the latest of the times it missed runs. - No run after you published an event. The filter's
typemust match the event's type exactly, and events recorded before the trigger was saved never start it. Ask the agent to list the playbook's events of the typereaction_refusedwithlist_playbook_events. They say what a trigger did not start and why, such as "The workflow could not be started by its event trigger:" followed by the reason. - No run after something happened in the app. If Auto checks the app, the run comes after its next check, about a minute later. Check that it happened after the trigger was saved, in the place the workflow watches, and that it was not done by the account the app is connected with, another app or a bot. Then see When an app stops starting runs.
- A run started and was rejected. Ask the agent for the run's rejection. A rejection for its input means the steps did not get what they expect. A scheduled run gets only its due time, and a run an event started gets a list holding the event. Give it its input as in step 1, or shape it with
input.fromas in step 6. - A workflow does not start for its own events. That is by design. A workflow does not start for its own runs, for runs they started, or for events its runs emit.
- Requests pile up. Each run of a workflow that asks for an approval sends a request, which
list_interactionsshows while it is open. Replace a test trigger once it has started its first run, and cancel the runs you do not need.
When an app stops starting runs
The workflow's page in Auto Studio says why, and your agent can tell you, as in step 11. What to do depends on the reason:
| Why | What to do |
|---|---|
| Auto is still setting it up with the app | Wait. If it stays this way, reconnect the app |
| The app did not answer when Auto set it up | Nothing. Auto tries again |
| The app is not connected yet, needs reconnecting, or needs one more setup step | Connect or reconnect it in Auto Studio, under Settings, Connections |
| The account the app is connected with lacks the access this needs | Reconnect the app with an account that has it |
| The connection is no longer available to this playbook | Make it available to the playbook again, or ask your agent to use another connection |
| The app refused Auto's request | The place the workflow names may not exist there, or may be written differently. Ask your agent to correct it |
| The playbook already watches as many places in the app as one connection allows | Ask your agent to watch fewer places |
| Your Auto Runtime can't receive events from this app | Ask your agent to start the workflow on a schedule instead |
If you can't manage your organization's connections, ask an admin to connect or reconnect the app.
What happens to the things you missed while the app was not starting runs:
- If the workflow normally starts right away, they are skipped. The workflow starts again for what happens after the app is reconnected.
- If Auto checks the app, it catches up. Once the app is reconnected, the workflow starts for what happened in the meantime.
When a filter goes past its bounds
Each event filter is held to the bounds the trigger reference gives, and its failure affects no other workflow's filter. When a filter goes past them:
- An expression that raises on an event, or does more than its work, does not match that event, since the event's data can cause either. The playbook records that once for each version, and evaluates the filter again on the next event.
- A filter stopped by its deadline or its memory does not match either, since the event cannot cause that. The event waits and is matched again on a later sweep (the server's regular pass over waiting work, every second by default).
- A filter so stopped 3 times in a row, with no completed evaluation between, has a defect of its own. The playbook records that once, and does not evaluate it again for that version of the workflow. The event it waited on goes on without it. The remedy is a new version with a cheaper filter.
- Keep a filter to a quick test of the event's data: the 200 milliseconds are the server's wall-clock time, so a loaded server may stop one near them.
- The playbook keeps what it stopped in memory, so a restart evaluates the filter again.
Next
- Triggers has the filters, the trigger limits and the rules for new versions.
- Workflows and runs explains how runs start, wait and end.
- Lookup function format shows how a step reads back what earlier runs kept, from the outputs of a definition's runs.