definePlay — schedule, which changes count, how records enrol, and which rows are eligible. All of it deploys with cargo-ai cdk deploy.
Configure triggers in code
plays/onboarding.ts
Schedule
Theschedule field selects how the play is driven:
schedule | Behavior |
|---|---|
{ type: "realtime" } | Fire instantly as the model’s rows change |
{ type: "cron", cron: "0 * * * *" } | Run on a cron expression (UTC) |
{ type: "dependency", play: upstream } | Run after another play finishes |
{ type: "watch" } | Run on a watched external schedule |
{ type: "dbt", jobId: "…" } | Run after a dbt job completes |
Real-time schedules are currently only available for HubSpot and
Salesforce. The minimum interval for scheduled syncs depends on the model
type (as short as 5 minutes, up to 1 day); a sync is skipped if the model was
already refreshed within that window.
Change detection
changeKinds controls which row changes create a run. Defaults to ["added"].
- Real-time schedules know exactly what happened — a row was
added(created in the source) orupdated. - Scheduled syncs (cron, dependency, watch) compare snapshots, so
addedmeans “appears in this sync but not the last” — which includes newly created rows, rows that now match thefilterfor the first time, and restored rows.
Enrolment rules
runCreationRule controls what happens when a record triggers repeatedly:
| Value | UI equivalent | Behavior |
|---|---|---|
"always" | Always enrol | New run every time the trigger fires for that record |
"once" | Enrol once | Each record is enrolled at most once, ever |
"noConcurrency" | If is not currently enrolled | Skip if the record is already in an active run |
Eligibility filter
filter (and optional sort, limit) restricts which rows are eligible. It uses the same JSON schema as the UI segment builder and the segment download CLI command.

