Skip to main content
LabsThis feature is in Labs. Contact your account team to enable this feature.
Otto Routines run Otto on a schedule or when an event occurs, without anyone in a session. Each Routine follows the instructions you wrote and sends the result to your notification channels. A Routine has a trigger, instructions, a role that the run uses, and the channels that receive the result. You can start from a managed Routine that Astronomer maintains, or write your own. Example use cases for Routines include:
  • Investigate each Dag failure and send the root cause and a fix to Slack.
  • Send a daily report of failing Dags and Deployment health to your team every morning.
  • Summarize the Dag runs of the previous week for a Workspace every Monday.
  • Check the Dags in a Deployment every hour and post new failures to a Slack channel.
  • Read the Dag code in your GitHub repository when a Dag fails, and suggest a code fix.

How Routines work

A Routine belongs to one Workspace or one Deployment. Its trigger is one of the following:
  • Dag failure: One of the selected Dags in the Routine has a failed run.
  • Schedule: A cron schedule starts a run.
Each run executes as the Routine’s run-as role, not as the user who created the Routine. Astro gives the run a single-use API token with that role at the Routine’s Workspace or Deployment. The token expires shortly after the run’s timeout. See Permissions and security. When a run completes, Astro sends its result to the Email and Slack notification channels of the Routine. The run page in the Astro UI also shows the run’s Result, Steps, Duration, and Cost. A run has one of the following statuses:
Astro sends notifications only for completed runs. A failed, cancelled, or skipped run doesn’t send a notification. To find these runs, open the Routine’s run history.

Create a Routine

Prerequisites

  • Access to Otto Routines. To request access, contact your Astronomer account team.
  • The Workspace Author or higher role in the Workspace, or the Deployment Admin role for a Deployment Routine. See User permissions.
  • At least one Email or Slack notification channel for the Workspace or Deployment, if you want to receive results.

Create a Routine in the Astro UI

  1. In the Astro UI, go to Build > Routines.
  2. Click New Routine.
  3. In What should Otto do?, select a managed Routine or click Start from scratch.
  4. Enter a Name. The name has a maximum of 64 characters.
  5. Configure the trigger. If you start from scratch, select the trigger type first. See Configure a Dag failure trigger or Configure a schedule trigger.
  6. In Instructions, enter what Otto does on each run. The instructions have a maximum of 20,000 characters. For a managed Routine, this field is Guidance, and it’s optional.
  7. In As role, select the role that each run uses. This field has no default.
  8. (Optional) In MCP servers, select up to 10 MCP servers that Otto can use during a run.
  9. (Optional) In Code access, give Otto access to your GitHub code.
  10. In Channels, select up to 10 Email or Slack notification channels. To add a channel, click New Notification Channel.
  11. (Optional) In the advanced settings, change Timeout after and the run limits. See Configure a Dag failure trigger.
  12. Click Create Routine.
After you create a Routine, click Test on its detail page to run it one time. See Monitor and manage Routines.

Configure a Dag failure trigger

Select When a Dag fails, then select up to 10 entries in Dags. You can also select all Dags in a Deployment. Each failure of a matching Dag starts a run. A Dag failure Routine has two run limits that stop a failing Dag from starting too many runs:
  • Routine run limit: The maximum number of runs of the Routine in the limit window. The default is 50 runs in 24 hours.
  • Run limit for each Dag: The maximum number of runs for one Dag in the limit window. The default is 24 runs in 24 hours. This limit can’t be more than the Routine run limit.
Astro skips a run, and records it with the Skipped status, when a limit is reached or when the same Dag already has a run in progress.

Configure a schedule trigger

Select On a schedule, then select the Workspace or Deployment and a Schedule. You can select one of the following:
  • Every hour
  • Every N hours, where N is 2, 3, 4, 6, 8, or 12
  • Every day
  • On days of the week
  • Custom cron
A custom cron schedule uses five fields and a time zone. Cron descriptors such as @daily aren’t supported. The minimum interval between two runs is 15 minutes. The default schedule is 0 7 * * 1-5, which runs at 07:00 from Monday to Friday, in the time zone of your browser.

Managed Routines

Managed Routines are Routines with instructions that Astronomer writes and maintains. Astro doesn’t create or turn on a managed Routine for you. To use one, select it when you create a Routine. You can’t change the trigger type of a managed Routine. To add your team’s context, enter it in Guidance. Where your guidance conflicts with the instructions from Astronomer, Otto follows your guidance. To turn off a managed Routine, pause it or delete it the same way as any other Routine. See Monitor and manage Routines.

Monitor and manage Routines

Go to Build > Routines and click a Routine to see its run history. Click a run to see its result, steps, duration, and cost. Use the actions menu of a Routine to manage it: To stop a run in progress, open the run and click Cancel Run. A test run doesn’t stop at the run limits, but it counts toward them for later runs. A Routine can have a maximum of five test runs in progress at the same time. When you delete a Workspace or a Deployment, Astro deletes its Routines.

Permissions and security

Which identity a run uses

Each run uses a single-use API token that belongs to the Astro Routine Runner system user, not to you. The token has the run-as role at the Routine’s Workspace or Deployment, so a run can do only what that role allows. You select the run-as role in As role:
  • Workspace Routine: Workspace Owner, Workspace Operator, Workspace Author, Workspace Member, or Workspace Accessor.
  • Deployment Routine: Deployment Admin, Deployment Accessor, or a custom Deployment role.
Astronomer recommends the role with the fewest permissions that the work needs. For a Routine that only reads and reports, use Workspace Member. You can assign only a role that you can grant yourself. Astro checks this when you create a Routine, when you start a test run, and when you change the role, the instructions, the MCP servers, or the code access. Routine runs don’t use the approval prompts in Otto permissions. The run-as role sets what a run can do.

Who can manage Routines

  • A Workspace Member can view the Routines in the Workspace and their run history.
  • A Workspace Author or higher can also create, edit, and delete Routines in the Workspace and its Deployments.
  • A Deployment Admin can do all Routine actions for their Deployment.

When a user loses access

A run doesn’t use the permissions of the user who created the Routine. If that user loses access to the Workspace or Deployment, or leaves your Organization, the Routine continues to run with its run-as role. To stop the Routine, a user with access pauses or deletes it. Review the Routines in a Workspace when a user leaves your team.