Example requests
Ask your coding agent when an automation should start. It can wire up the source, target, filters, and payload shape.“Build an agent that sends me a morning brief every weekday at 9am in Slack.”
“When a Stripe payment succeeds, update the customer record in our CRM and start the Zendesk onboarding workflow.”
“Check our vendor API every hour, and run the pending invoice workflow when a new invoice is marked as ‘ready to process’.”
Source plus attach
Triggers live in your project code undersrc/triggers/. Each file defines a source, then chains .attach() to bind it to a workflow or agent, and default-exports the result.
src/triggers/signup.ts
.attach(), a chain of .attach() calls, or an array of attachments (see fan out to multiple targets).
The three sources
There are exactly three trigger source types. Each takes aslug (the stable trigger slug) plus options specific to how it fires.
| Source | Define with | Fires when |
|---|---|---|
| Schedule | defineCronSource | A cron schedule comes due — every tick dispatches all enabled attachments (no filters) |
| Webhook | defineWebhookSource | A request POSTs to the trigger’s endpoint and matches its schema |
| Poll | definePollSource | A scheduled run() returns a payload that passes its filters — filtered ticks create no run |
Attach to a workflow or an agent
.attach() binds the source to one of two targets:
transform to shape the payload into the workflow’s input. An agent target takes a prompt (a string, or a function of the payload) instead. See advanced triggers for both in depth.
Attachment id
Each attachment has an id of the form{sourceSlug}:{targetSlug}, the source slug joined to the workflow or agent slug:
Filters live on the source, transform on the attachment
Keep the two concerns separate:- Filters decide whether to run, and are part of the source: a webhook’s
request/filterZod schemas, or a poll’sfilterpredicates. transformdecides what input the run receives, and is part of the attachment (workflow targets only).
Disable individual attachments
Each attachment can be paused without removing it from your project code. Disabled attachments stay visible in the dashboard and API, but they do not match webhook ingress, receive cron ticks, or receive poll results.- Disable one workflow or agent binding while leaving sibling attachments on the same source active.
- Re-enable the attachment later without redeploying.
- The disabled state survives redeploys — a later deploy does not re-enable a paused attachment.
- When every attachment on a scheduled source is disabled, its schedule stops firing until at least one attachment is enabled again.
PATCH /api/triggers/:triggerId/attachments/:attachmentId), or the CLI:
--workflow/--agent — you never need the attachment id.
Inspect trigger runs
Triggers are typically operated against a deployed (cloud) project. List them, print a webhook URL, run a poll on demand, and audit runs from the CLI:Next steps
Schedules
Run a workflow or agent on a cron schedule.
Webhooks
Run on inbound HTTP requests with a validated payload.
Polling
Periodically check a source and run when there’s work.
App events
React to events from connected third-party apps.