Let a preflight decide which events file a task
Do this when an event automation files tasks for events you don't want worked on, such as every push or every message in a channel. A preflight runs before each event files. It answers run or skip, or splits one event into several items, each filed as its own task.
Who can do this: your organization's Owners and Admins. Only event automations have a preflight; a schedule has none.
- In the sidebar, select Audit, then the automation's row on the Automations tab.
- Select the Settings tab. Preflight is the first field under When.
- Pick how the preflight decides:
- None: every event files as it arrives. This is where a new automation starts.
- Script: runs a script from the project's repository on one of the project's online nodes.
- Model: asks a model, with your prompt.
- For Script, type the script's place in the repository in Script path, such as
scripts/triage.py. The script reads the event and prints its answer. Hover the field's label for what it gets. - For Model, write what the model should judge in Preflight prompt, such as "Skip events from bots. Run for anything that mentions a failing build." Then pick the key it is billed to in Anthropic API key.
- In Timeout (seconds), set how long the preflight may take before it counts as failed: 5 to 165 seconds.
- Select Save at the bottom of the page.
- When the next event arrives, open the Runs tab and read its outcome:
- Preflight running: the preflight hasn't answered yet.
- Filtered: the preflight skipped the event, with the reason it gave.
- Failed: the preflight broke or ran out of time. The reason starts with "preflight failed".
A failed preflight counts toward Pause after consecutive failures, so while that is on, a broken script can pause the automation. Fix the script or prompt, then resume it as in Run, pause or change an automation.
Related
- Create an automation: set up an event automation before you add a preflight.
- How automations work: When, Target and Action, and how to read runs.
- Let an automation act on an event again: file a task for an event that was already seen.