Skip to content

Triggers ​

A trigger is what starts a flow. You set it on an input with trigger: "schedule". A schedule is the only trigger: it starts the flow on repeat, or once at a set time.

Schedule ​

A schedule takes exactly one of cron and at. You can add a timezone.

cron: repeat ​

cron repeats the flow. Write it in crontab format: five fields, separated by spaces.

FieldValues
minute0–59
hour0–23
day of month1–31
month1–12, or JAN–DEC
day of week0–7, where 0 and 7 are Sunday, or SUN–SAT

Names can be in any case. Each field is one of these, or a comma list of them:

  • * matches any value.
  • A value, such as 9, matches that value.
  • A range from a lower value to a higher one, such as 9-17 or MON-FRI, matches every value in it. SAT-SUN isn't valid, because SUN counts as 0: write 6-7 instead.

* and a range can take a step: */15 is every 15th minute, and 9-17/2 every second hour from 9 to 17.

Only these five fields are allowed. Shortcuts such as @daily, a sixth field for seconds or years, and the characters ?, L, W and # aren't valid.

Code:
mermaid
agentflow TB
  weekday[/"Weekdays at 09:00"/]@{ trigger: "schedule", cron: "0 9 * * 1-5" }
  office[/"Every 15 minutes, office hours"/]@{ trigger: "schedule", cron: "*/15 9-17 * * MON-FRI" }
  monthly[/"1st and 15th"/]@{ trigger: "schedule", cron: "0 8 1,15 * *" }

  flow triage["Issue triage"]
    read["Read issues"]@{ instruction: "Summarise every open issue." }
  end

  weekday --> triage
  office --> triage
  monthly --> triage
Ctrl + Enter|

at: run once ​

at runs the flow once. Write a date and a 24-hour time as YYYY-MM-DDTHH:MM. The date has to exist, so 2026-02-30T09:00 isn't valid.

Code:
mermaid
agentflow TB
  launch[/"Launch day"/]@{ trigger: "schedule", at: "2026-12-24T09:00" }

  flow announce["Announce"]
    post["Post"]@{ instruction: "Post the launch announcement." }
  end

  launch --> announce
Ctrl + Enter|

timezone ​

cron and at are read in timezone. When you leave it out, they are read in UTC. Use a time zone name, such as "UTC", "Europe/Madrid" or "America/New_York".

Code:
mermaid
agentflow TB
  weekday[/"Weekdays at 09:00"/]@{ trigger: "schedule", cron: "0 9 * * 1-5", timezone: "Europe/Madrid" }

  flow triage["Issue triage"]
    read["Read issues"]@{ instruction: "Summarise every open issue." }
  end

  weekday --> triage
Ctrl + Enter|

Rules ​

Common mistakes ​

An input with no trigger.

Code:
mermaid
agentflow TB
  weekday[/"Weekdays at 09:00"/]@{ cron: "0 9 * * 1-5" }

  flow triage["Issue triage"]
    read["Read issues"]@{ instruction: "Summarise every open issue." }
  end

  weekday --> triage
Ctrl + Enter|

Input "weekday" is missing its "trigger" setting. Add trigger: "schedule".

A schedule with neither cron nor at.

Code:
mermaid
agentflow TB
  weekday[/"Weekdays at 09:00"/]@{ trigger: "schedule" }

  flow triage["Issue triage"]
    read["Read issues"]@{ instruction: "Summarise every open issue." }
  end

  weekday --> triage
Ctrl + Enter|

Input "weekday" is missing its schedule, which a "schedule" trigger needs. Add "cron" to repeat, such as "0 9 * * 1-5", or "at" to run once, such as "2026-12-24T09:00".

A crontab shortcut instead of the five fields.

Code:
mermaid
agentflow TB
  daily[/"Every day"/]@{ trigger: "schedule", cron: "@daily" }

  flow triage["Issue triage"]
    read["Read issues"]@{ instruction: "Summarise every open issue." }
  end

  daily --> triage
Ctrl + Enter|

The "cron" setting on input "daily" isn't valid: "@daily" is not a valid schedule. Use the crontab format, such as "0 9 * * 1-5".

The setting name as the trigger. The trigger is always "schedule"; cron is a setting next to it.

Code:
mermaid
agentflow TB
  weekday[/"Weekdays at 09:00"/]@{ trigger: "cron" }

  flow triage["Issue triage"]
    read["Read issues"]@{ instruction: "Summarise every open issue." }
  end

  weekday --> triage
Ctrl + Enter|

The "trigger" setting on input "weekday" can't be "cron". Use "schedule".

Opens in mermaid.ai