Triggers
A trigger arms a workflow as an entrypoint for abt watch: an external event (a Slack
message, a GitHub PR, a Jira transition, a cron schedule) auto-dispatches the workflow. Like
sources and exposures, a trigger is a standalone triggers/*.yaml resource. A workflow's trigger: field references it by name.
A trigger does nothing by itself: abt watch has to be running to poll for events. See Running triggered workflows.
Declaring a trigger
# triggers/every_morning.yaml
name: every_morning
description: Fires daily-digest every weekday morning
type: cron
config:
schedule: "0 9 * * 1-5"
enabled: true # triggers are dormant unless this is true — see below
Keys: name, description, type, credentials (a profiles.yaml namespace; defaults to the type), config, filter, enabled, tags.
Referencing a trigger from a workflow
A workflow's trigger: takes one of two forms. A bare name is a plain reference with no
{{ event.* }} -> var binding. A single-key mapping {name: {vars: {...}}} binds per-event
data at the ref site. The workflow's full key list is in Workflows.
Save this as agents/daily-digest.md. The agent declares no trigger:; only the workflow does:
---
description: Writes the daily digest
---
Write today's digest in three bullet points.
This run fired at {{ var('fired_at', 'an unknown time') }}.
The bare name, for the every_morning trigger above:
# workflows/daily_digest.yaml
trigger: every_morning
steps: [daily-digest]
The mapping form, which fills fired_at from the event:
# workflows/daily_digest.yaml
trigger:
every_morning:
vars:
fired_at: "{{ event.raw.fire_time }}"
steps: [daily-digest]
Give every bound var a compile-time value. The binding is filled when an event arrives, but
abt compile runs with no event. A {{ var('fired_at') }} without a default fails with
Missing required template variable(s) 'fired_at'. Add a default, as in the agent above, or a
placeholder under vars: in abt.yaml. At dispatch the event's value replaces either one. The
abt watch quick start shows this end to end.
The name in trigger: must match the name: of a triggers/*.yaml file. A name that matches no file fails abt compile with Workflow '<name>' trigger: '<trigger>' not found, and lists the known triggers. Fix the name or add the trigger file. After adding a trigger, check that abt watch list shows it against the workflow.
enabled — dormant by default
A triggers/*.yaml resource is enabled: false by default. Arming a trigger against real credentials (a Jira board, a Slack channel) should be a deliberate decision, so it never turns on just because the file exists:
# triggers/jira_auto_resolve.yaml
name: jira_auto_resolve
type: jira
credentials: atlassian
config:
jql: "project = MOCK"
watch:
- {field: status, to: "In-Progress"}
enabled: false # a real board would be in scope here — enable it deliberately
tags: [jira]
abt watch list shows every trigger's enabled state and the workflow it arms (dormant [cron] (disabled) → workflow p_dormant); abt watch produce/abt watch run skip disabled triggers and log how many (Watch: 1 trigger(s) skipped (enabled: false)), so a dormant trigger is never a silent mystery.
Trigger types
type: is cron, slack, github, or jira. An unknown type passes abt compile and abt watch list; abt watch run/produce then logs failed to start source for '<workflow>' and runs without that workflow's source. Compile does not check the config: of a type either: a missing jql, an invalid cron expression or an unknown top-level key still compiles, so check them against the tables below. Polling, dedup and Socket Mode behavior are in abt watch — Trigger types.
cron
| Key | Required | Meaning |
|---|---|---|
config.schedule |
Yes | Five-field cron: minute, hour, day of month, month, weekday. Evaluated in UTC. |
No credentials and no filter.
Cron syntax: numeric fields only (no MON or JAN). Each field accepts *, a, a-b, a,b, */n, a-b/n, and a/n. Weekday 0 and 7 both mean Sunday. When both day of month and weekday are restricted, the job fires when either matches.
| Event field | Value |
|---|---|
event_type |
scheduled |
scope_id |
The trigger's name |
event_id |
The fire time (ISO 8601) |
raw.schedule, raw.fire_time |
The cron expression and the scheduled UTC time |
jira
| Key | Required | Meaning |
|---|---|---|
config.jql |
Yes | JQL to poll. A trailing ORDER BY is removed. |
config.watch |
No | List of conditions. {field: <name>, to: <value>} fires on a change to that field (omit to for any change). {created: true} fires on new issues. |
config.poll_interval_seconds |
No | Poll interval (default 60). |
config.max_results |
No | Issues per poll (default 50). |
config.lookback_minutes |
No | Minutes of overlap added to each poll window, to cover Jira indexing lag. |
Credentials: atlassian.
| Event field | Value |
|---|---|
event_type |
issue_created, or <field>_changed (for example status_changed) |
scope_id, thread_id |
The issue key |
user_id |
The assignee's name |
text |
The issue summary |
raw.key, raw.summary, raw.status |
Issue key, summary, and current status |
raw.field, raw.to, raw.matched_at |
The changed field, the new value, and when the change happened |
github
| Key | Required | Meaning |
|---|---|---|
config.repo |
Yes | Repository as owner/name. |
config.events |
No | Event types to watch (default pull_request). Values: pull_request, pull_request_review, pull_request_review_comment, issue_comment, issues, push. |
config.actions |
No | Only keep events whose action is in this list. |
config.poll_interval_seconds |
No | Poll interval (default 30). |
filter.ignore_bots |
No | Skip events from bot accounts (default true). |
filter.branches, filter.labels |
No | Keep only PRs on these branches or with these labels. |
Credentials: github (token), or the GITHUB_TOKEN environment variable.
| Event field | Value |
|---|---|
event_type |
The events value that matched |
scope_id |
The repository |
thread_id |
The PR or issue number (the git ref for push) |
user_id |
The actor's login |
text |
The PR or issue title, or the comment body for issue_comment |
raw.type, raw.action, raw.actor |
GitHub event type, action, and actor. The GitHub payload is also under raw (for example raw.pull_request). |
slack
| Key | Required | Meaning |
|---|---|---|
config.channel_ids |
No | Channel IDs to watch. Omitted or empty means every channel the bot can see. |
config.events |
No | message and thread_reply (the default), reaction_added, and app_mention. The last two need app_token. |
config.poll_interval_seconds |
No | Seconds between polls when there is no app_token (default 5). |
config.queue_maxsize |
No | Events buffered before a stalled consumer drops the newest (default 1000). |
config.progress, progress_text, progress_reaction |
No | Opt-in "working on it" status while the agent runs. |
Credentials: slack, with bot_token (required) and app_token. With app_token the trigger listens over Socket Mode. Without it, the trigger polls, and reaction_added and app_mention events are never received.
| Filter key | Meaning |
|---|---|
ignore_bots, ignore_humans |
true/false, or {events: [...]} to scope it to some event types. |
ignore_users |
User IDs to skip, or {id, events} entries. |
require_mention, require_mention_in_thread_only |
Only fire when the bot is mentioned. |
reactions |
For reaction_added: the reaction names to allow. |
The bot filters (ignore_bots, ignore_humans, require_mention) need the bot's own user id, which the trigger reads from Slack's auth.test at start-up, retrying three times. If Slack still does not answer, the trigger does not start, logs could not resolve the bot's user id, and tries again on the next reconcile, rather than run with the filters off.
| Event field | Value |
|---|---|
event_type |
message, thread_reply, app_mention, or reaction_added |
scope_id |
The channel ID |
thread_id |
The thread timestamp (for a reaction, the root of the reacted-to thread) |
user_id |
The Slack user ID |
text |
The message text, or the emoji name for reaction_added |
event_id |
The message timestamp |
raw |
The Slack event payload |
Examples
These show each trigger type wired end to end: a triggers/*.yaml resource, the workflow that uses it, and the vars: bindings that read {{ event.* }}. Each workflow names one agent (review-pr, daily-digest, jira-resolver). To compile the examples, save the plain agent from Workflows under those names.
Slack example
# triggers/support_slack.yaml
name: support_slack
type: slack
credentials: slack # bot_token/app_token from credentials.slack in profiles.yaml
config:
channel_ids: [C0EXAMPLE01, C0ANOTHER]
poll_interval_seconds: 5
queue_maxsize: 1000 # cap on buffered events before a stalled consumer drops the newest (default 1000)
events:
- message # new top-level message
- thread_reply # reply in a thread
progress: true # native "is working…" thread status while the agent runs (opt-in, default false)
progress_text: "is investigating…" # default: "is working on it…"
progress_reaction: eyes # also add/remove this emoji on the triggering message (opt-in, needs reactions:write)
filter:
ignore_bots: true # skip bot messages
# ignore_humans: true # inverse of ignore_bots — skip everything except bot/system
# # events (messages and reactions alike, unless scoped — see
# # "Scoping ignore_bots/ignore_humans" below). Requires
# # ignore_bots: false too, or `abt compile` fails — see below.
# ignore_users: ["U0123ABCDE"] # skip messages/reactions from specific Slack user IDs
# # (e.g. a channel maintainer who doesn't need the bot's
# # help) — see "Scoping ignore_users" below for the
# # {id, events} form that only ignores some event types.
require_mention: true # only trigger on @bot mention (gates every event, including
# top-level messages — mutually exclusive in practice with
# require_mention_in_thread_only below)
# require_mention_in_thread_only: true # narrower alternative: only gate thread
# # replies on @bot mention, so any new
# # top-level channel message always triggers
enabled: true
Scoping ignore_users to specific event types
The YAML fragments in this section replace the matching keys of triggers/support_slack.yaml
above. Each entry in filter.ignore_users is either a plain Slack user ID (ignored for every
event type) or an {id, events} mapping (ignored only for those event types). Mix and
match freely in the same list:
filter:
ignore_users:
- "U0123ABCDE" # ignored everywhere: messages, thread replies, reactions
- id: "U0456FGHIJ" # ignored only for the listed event types
events: [message, thread_reply] # — their reactions still get through
Concrete example: an internal expert's messages shouldn't trigger a bot reply, but their
:white_check_mark: approval reaction on someone else's message should still dispatch the
workflow:
# triggers/support_slack.yaml (excerpt)
config:
events: [message, thread_reply, reaction_added]
filter:
ignore_bots: false
ignore_users:
- id: "U0456FGHIJ" # the expert's Slack user ID
events: [message, thread_reply] # their own messages/replies are ignored...
# # ...but reaction_added isn't listed, so their
# # :white_check_mark: on a message still triggers.
A malformed entry (missing events, an id that isn't a string, an unknown key, etc.)
fails abt compile with a message naming the bad entry. It never reaches abt watch run.
ignore_humans has the same "let bot-only through" semantics for reactions as it does for
messages: since a reaction_added event only ever carries the reactor's Slack user ID
(never a bot flag), the trigger identifies "bot" reactions as only its own. So
ignore_humans: true drops every reaction except ones the bot itself added (e.g. via
progress_reaction on another trigger, or another agent run).
Scoping ignore_bots/ignore_humans to specific event types
Like ignore_users, ignore_bots and ignore_humans each accept an {events: [...]}
mapping instead of a plain bool. It then applies only to those event types, not to every
event the trigger watches:
filter:
ignore_bots: false
ignore_humans:
events: [message, thread_reply, app_mention] # reaction_added isn't listed, so a
# # human's reaction still fires
reactions: ["morning_glow"]
Concrete example: a bot/webhook-fed alerts channel (Monte Carlo, dbt, anodot) where the
alert messages themselves should start a fresh investigation thread, human chatter
shouldn't, but a human's :morning_glow: reaction on an alert should still dispatch the
workflow. The plain-bool form cannot express this, because ignore_humans: true would
also drop the reaction:
config:
events: [message, app_mention, reaction_added, thread_reply]
filter:
ignore_bots: false # bot-posted alerts must get through
ignore_humans:
events: [message, app_mention, thread_reply] # human chatter doesn't start/continue
# # a thread, but reaction_added isn't
# # listed, so their reaction still does
reactions: ["morning_glow"]
abt compile still rejects a filter that drops every event type the trigger watches
(bots and humans alike). It checks per event type instead of assuming both
flags are plain bools. If config.events is omitted, that check (and the trigger
itself, at runtime) both default to [message, thread_reply].
GitHub example
Polls the GitHub repo Events API. Only events that arrive after watch starts are processed (historical events are ignored on first poll).
# triggers/pr_review.yaml
name: pr_review
type: github
credentials: github # credentials.github.token in profiles.yaml
config:
repo: org/repo # owner/name
events: [pull_request] # pull_request, pull_request_review, pull_request_review_comment, issue_comment, issues, push
actions: [opened, synchronize] # GitHub event actions to match (optional, all if omitted)
poll_interval_seconds: 30 # default 30
filter:
ignore_bots: true # skip actor.type == "Bot"
branches: [main] # match PR head/base or push ref (optional)
labels: ["ai-review"] # require at least one label on the PR/issue (optional)
enabled: true
# workflows/review_pr.yaml
trigger:
pr_review:
vars:
repo: "{{ event.scope_id }}" # owner/name — use scope_id, not event.raw.repository
pr_number: "{{ event.raw.pull_request.number }}"
action: "{{ event.raw.action }}"
author: "{{ event.raw.actor.login }}"
steps: [review-pr]
Uses ETag conditional requests to minimize API quota. On 304 (no new events), no quota is consumed.
Supported event types:
| GitHub event | events: value |
|---|---|
PullRequestEvent |
pull_request |
PullRequestReviewEvent |
pull_request_review |
PullRequestReviewCommentEvent |
pull_request_review_comment |
IssueCommentEvent |
issue_comment |
IssuesEvent |
issues |
PushEvent |
push |
Cron example
Fires on a schedule. It needs no external API, no credentials and no polling.
# triggers/every_morning.yaml
name: every_morning
type: cron
config:
schedule: "0 9 * * 1-5" # standard 5-field cron (minute hour day month weekday), evaluated in UTC
enabled: true
# workflows/daily_digest.yaml
trigger:
every_morning:
vars:
fired_at: "{{ event.raw.fire_time }}"
steps: [daily-digest]
A trigger with no event data the workflow needs can be referenced with a bare
name instead: trigger: every_morning.
Standard cron syntax: *, lists (a,b), ranges (a-b), steps (*/n, a-b/n).
Day-of-month and day-of-week use OR semantics when both are restricted (matches
cron convention — e.g. 0 0 1 * 1 fires on the 1st of the month or every
Monday). event.scope_id is the trigger name (or the schedule string if
unnamed); event.raw.fire_time is the scheduled UTC timestamp.
Jira example
Polls JQL for issues matching any configured watch condition. It needs no webhook or exposed
endpoint.
# triggers/jira_auto_resolve.yaml
name: jira_auto_resolve
type: jira
credentials: atlassian # url/server, username/email, api_token in profiles.yaml
config:
jql: "project = ENG" # bare condition, no ORDER BY
watch: # any ONE match fires this trigger
- field: status
to: "In Progress" # omit `to` to match any change to that field
- field: assignee
- created: true # new issue matching `jql`, not a field change
poll_interval_seconds: 60 # default 60
lookback_minutes: 2 # optional — default derived from poll_interval_seconds
max_results: 50 # optional page size, default 50, capped at 100 (polls page through all matches)
enabled: false
# workflows/jira_resolver.yaml
trigger:
jira_auto_resolve:
vars:
issue_key: "{{ event.raw.key }}"
field: "{{ event.raw.field }}"
steps: [jira-resolver]
- Dedup key:
(issue, watch entry)on the changelog timestamp of the match (orcreatedfor acreatedwatch), notupdated, because an agent's own write-back bumpsupdatedagain. A match never re-fires unless that field changes again; no retry-until-action behavior. field/tomatch case-insensitively (to: "in progress"==to: "In Progress"), matching Jira's own case-insensitive JQL matching, so a casing typo cannot silently stop a watch from firing.- A single mapping under
watch:(forgetting the list dash) is accepted as a one-item list; anything else invalid (a string, a list entry that isn't a mapping) raises a clear error. - Only changelog entries inside the current lookback window count as a match. Jira returns an issue's full history, so an old unrelated transition cannot match a watch by mistake.
- Stale dedup entries (outside the lookback window) are pruned each poll. This bounds memory and does not affect correctness.
- One issue matching two different
watchentries fires two independent events.event.event_typeis"{field}_changed"or"issue_created". - Only changes made after the watch started fire (pre-existing matches don't all fire at startup). Each poll reaches back to the last successful poll, so changes made while Jira was unreachable are caught up rather than dropped (in-process only, not across restarts).
- Not supported: comment emoji reactions. Jira exposes no JQL or changelog field for them.
- Two
watchmatches on the same issue within ~30s may collapse to one dispatch (sharedabt watchdedup keys on issue only, not field). This errs on the safe side: it can under-fire but never double-fires. Bind two separate triggers to two separate workflows if you need both guaranteed.
Event fields
Trigger vars: values can read these {{ event.* }} paths, whatever the trigger type:
| Path | Meaning |
|---|---|
event.source_type |
The trigger type (cron, slack, github, jira) |
event.event_type |
The kind of event (per type, above) |
event.scope_id |
Channel, repository, issue key, or cron trigger name |
event.thread_id |
Thread, PR or issue number, or issue key |
event.user_id |
The user or actor |
event.text |
The main text of the event |
event.event_id |
A per-occurrence ID, used for dedup |
event.timestamp |
Event time (Unix seconds) |
event.raw.<path> |
The source payload. Dotted paths work: {{ event.raw.issue.key }}. |
Checks for event.raw.* paths are type-specific, and nothing validates them at compile time.
Running triggered workflows
Declaring and enabling a trigger does nothing by itself. A process has to poll for events and dispatch matches. See abt watch for abt watch run (single process), abt watch produce/abt watch consume (distributed), and abt watch list.