<@ULVA73B9P> how does automation work on a flow ru...
# marvin-ai
j
@Marvin how does automation work on a flow run? Does the automation apply to all the job scheduled before configuring it?
m
thought for 160.6 seconds
Great question. Short answer: automations are event-driven and forward-looking. They do not retroactively evaluate past events. How automations work in Prefect 3.x: - You define a trigger (e.g., “a flow run enters Failed” or “a run becomes Late”), optional filters (by deployment, work pool, tags, etc.), and one or more actions (notify, run a deployment, change state, etc.). - Once enabled, the automation listens for future events that match its trigger and filters, then executes the action. Do they apply to jobs scheduled before you created the automation? - Not by creation/schedule time alone. Automations do not scan history or retroactively fire. - They will only fire for events that occur after the automation is enabled. - Important nuance: if a run was scheduled earlier but it emits the triggering event after the automation is enabled (e.g., it starts, becomes Late, fails, etc. after enablement), the automation will catch it. If the triggering event already happened before enablement, it won’t. Examples: - “Notify on failure”: will notify only for failures that happen after the automation is enabled. - “Late run alert”: a run scheduled before the automation that becomes Late after the automation is enabled will trigger the alert; runs that were already Late beforehand will not. Docs and references: - Automations (events schema) - Event and resource filters - Automation models and actions - Blog overview: Automations and observability If you share the specific trigger/action you’re setting up, I can confirm exactly how it will behave for your existing scheduled runs and suggest a quick way to test it.