David
03/06/2026, 9:00 PMDavid
03/13/2026, 12:52 PMMarvin
03/13/2026, 12:52 PMMarvin
03/13/2026, 12:56 PMprefect.flow-run.Completed
- Filter: Match flow-run events related to your specific “hourly” deployment (via match_related)
- Action: run-deployment to start the next deployment
Option A: Do it in the UI (Prefect Cloud / UI)
1. Go to Automations → New automation
2. Trigger
- Type: When a flow run enters a state
- State(s): Completed (add Failed too if you want it to trigger on failure)
- Filter: Deployment → select your hourly deployment
3. Action
- Type: Run a deployment
- Select the downstream deployment to start
4. Save and enable
Docs:
- Automations overview
- Creating automations (UI guide)
- Event triggers
Option B: Define as YAML and create via CLI
1) Find your deployment IDs (hourly and downstream)
prefect deployment ls -o json
2) Create an automation.yaml
name: "Run downstream when hourly completes"
description: "Starts the downstream deployment after the hourly deployment completes"
enabled: true
trigger:
type: event
posture: Reactive
expect:
- prefect.flow-run.Completed
# Primary resource is the flow run; filter the related deployment
match:
prefect.resource.id: "prefect.flow-run.*"
match_related:
- prefect.resource.role: "deployment"
prefect.resource.id: "prefect.deployment.<HOURLY_DEPLOYMENT_UUID>"
actions:
- type: run-deployment
source: selected
deployment_id: "<DOWNSTREAM_DEPLOYMENT_UUID>"
# optional:
# parameters:
# upstream_run_id: "{{ event.resource.id }}"
# schedule_after: 60 # delay 60s before starting
3) Apply it
prefect automation create --from-file automation.yaml
Variations
- Trigger on success or failure:
expect:
- prefect.flow-run.Completed
- prefect.flow-run.Failed
- Delay the downstream start:
actions:
- type: run-deployment
source: selected
deployment_id: "<UUID>"
schedule_after: 300 # 5 minutes
- Pass context to the downstream:
parameters:
upstream_flow_run_id: "{{ event.resource.id }}"
upstream_state: "{{ event.resource.labels['prefect.state-name'] }}"
Notes
- Event name for completion is exactly prefect.flow-run.Completed.
- Filtering “by deployment” is best done using match_related with:
- prefect.resource.role: "deployment"
- prefect.resource.id: "prefect.deployment.<UUID>"
- This works regardless of how the upstream run was scheduled (hourly cron, etc.).
Would you like me to draft this automation for your exact deployments? If so, share:
- The name/ID of your hourly deployment
- The name/ID of the downstream deployment
- Whether to run only on success or also on failure
- Any parameters you want to pass through