How do you schedule Prefect flows in 2026?
Quick Answer: As of April 2026, Prefect flows are scheduled by attaching a schedule (cron, interval, or RRule) to a deployment using `flow.serve()`, `prefect deploy`, or `prefect.yaml`. The Prefect API or local agent then triggers runs according to the schedule and routes them to a configured work pool.
Scheduling Prefect Flows
Prefect 3.x decouples flows (the code) from deployments (how, where, and when the code runs). Schedules attach to deployments.
Step 1 — Define the Flow
Decorate a Python function with @flow:
from prefect import flow
@flow
def daily_etl():
extract()
transform()
load()
Step 2 — Create a Deployment With a Schedule
The fastest path is flow.serve(), which runs a long-lived process that schedules and executes runs locally:
daily_etl.serve(name="daily-etl", cron="0 6 * * *")
Three schedule types are supported:
- Cron — Standard cron expression (e.g., "0 6 * * *")
- Interval — Recurring every N seconds/minutes/hours
- RRule — iCalendar RRULE (e.g., business-day-only)
Step 3 — Production Deployments
For production, use prefect deploy with a prefect.yaml file. The deployment registers with Prefect Cloud or self-hosted Prefect Server, and runs are dispatched to workers in a work pool (Process, Docker, Kubernetes, or ECS).
deployments:
- name: daily-etl
entrypoint: flows/etl.py:daily_etl
work_pool:
name: kubernetes-pool
schedules:
- cron: "0 6 * * *"
timezone: "UTC"
Step 4 — Pause, Skip, and Backfill
Schedules can be paused via the UI or prefect deployment schedule pause. Backfills are triggered with prefect deployment run and an explicit start/end window.