SSyncropel Docs

Scheduled triggers

Run periodic work on a schedule (daily summaries, stale-task reminders, trust audits) without an external scheduler.

This page is for people running their own workspace or using the API. If you use a workspace created at syncropel.com, start with Your hosted workspace.

What they are

A trigger starts an actor on its own. Triggers come in two kinds:

  • Record-matching: fire when a new record matches a CEL expression (see Routing rules)
  • Schedule-based (this guide): fire on a cron schedule

This guide is about schedules, such as "give me a daily summary at 9am". You don't need an external scheduler.

Prerequisites

  • A running workspace (spl serve)
  • An actor DID to dispatch to (typically did:sync:agent:<role>)
  • The actor must have a registered adapter (see Actors and adapters)

Quickstart: daily summary

Dispatch your dev agent every morning at 9am to summarize yesterday's work:

spl config add-trigger \
  --name "daily-summary" \
  --schedule "0 9 * * *" \
  --target "did:sync:agent:dev" \
  --goal "Summarize yesterday's commits + open tasks, post as KNOW on th_daily_summary" \
  --cooldown 300 \
  --budget 0.5 \
  --timeout 600

Cron format is standard: minute hour day month weekday. The above reads "at 9am UTC every day". Schedules are checked about once a second, so a trigger fires within about a second of its time.

Verify the trigger

spl config list-triggers

Look for your new entry. Confirm it's enabled: true and the schedule matches. To see past firings:

spl config trigger-history --limit 10

Each row shows the trigger name, firing time, the thread it produced, and the cost.

Pause, resume, remove

spl trigger is the verb group for a trigger's life after it exists. list and show show the triggers that are actually running. A trigger whose schedule, timezone or idempotency setting is invalid is not loaded and is marked REFUSED in the listing, so it is never mistaken for a working one.

spl trigger list                 # the live set, with refusals marked
spl trigger show <name>          # the whole definition
spl trigger pause <name>         # stops firing; keeps the whole definition
spl trigger resume <name>        # puts it back exactly as it was
spl trigger remove <name>        # removes it for good

remove does not delete the original definition. The removal is added to the history, because records are never overwritten. One consequence: creating a trigger with the same name again brings it back.

You can also remove a trigger that shows as REFUSED.

Common patterns

Stale-task reminder

Every 4 hours, post a reminder for any task that has been in_progress for more than 48 hours:

spl config add-trigger \
  --name "stale-task-check" \
  --schedule "0 */4 * * *" \
  --target "did:sync:agent:ops" \
  --goal "For each task where status == in_progress and age > 48h, emit KNOW with reminder" \
  --budget 0.2 \
  --timeout 300

Trust decay audit

Each week, list the actors whose trust has dropped, for you to review:

spl config add-trigger \
  --name "weekly-trust-audit" \
  --schedule "0 10 * * MON" \
  --target "did:sync:agent:auditor" \
  --goal "List actors whose trust.code.effective dropped >0.1 in the past 7 days" \
  --budget 0.3

Fleet heartbeat verification

Every 15 minutes, check that every fleet peer is reporting in:

spl config add-trigger \
  --name "fleet-peer-liveness" \
  --schedule "*/15 * * * *" \
  --target "did:sync:agent:ops" \
  --goal "Alert if any fleet peer has not heartbeat in 5 minutes" \
  --budget 0.1 \
  --timeout 180

Cron expression cheatsheet

SpecFires
0 9 * * *9:00am every day (UTC, unless the trigger names a timezone)
*/15 * * * *Every 15 minutes
0 */4 * * *Every 4 hours on the hour
0 10 * * MON10:00am every Monday
0 0 1 * *Midnight on the 1st of every month
30 8 * * MON-FRI8:30am on weekdays

Schedules are UTC unless the trigger names a timezone (an IANA name such as Europe/London).

Rate limiting

--cooldown <secs> sets a minimum gap between a trigger's firings. Use it to stop a trigger firing twice in quick succession by mistake.

Actors that run unattended

A scheduled actor's definition can say what its runs may write and what they owe:

  • work_loop.writes names the threads its runs may write, and work_loop.write_kinds the record kinds. Settings and permission threads and kinds are refused when the actor is defined, so a scheduled run can never create a trigger or change a workspace's limits.
  • work_loop.revert says how the actor's effects are undone. An actor that holds a tool with an effect outside the workspace (an HTTP call, for example) needs it to start. work_loop.contract and work_loop.promises state what a run commits to and produces. A trigger's dispatch can set its own contract, revert and promises for the runs it starts.
  • A run that promised a kind or a thread and wrote nothing to it shows stopped_short with the reason promised <kind>, wrote none, never done.
  • A failed item in a batch frees its place, and if the actor asks the same question again, it replaces the older unanswered copy in your call.

When a hosted workspace sleeps

A hosted workspace sleeps when nobody is using it. Scheduled triggers run while the workspace is awake. When a trigger falls due while the workspace sleeps, the missed run is handled the next time the workspace wakes, for example when you open it. The trigger's catch-up setting (catchup) decides what happens: skip the missed run, run only the most recent one, or run each one it missed.

A sleeping hosted workspace does not wake itself when a trigger falls due. Do not rely on a schedule firing on time while nobody is using the workspace.

On the free plan, a trigger whose schedule fires more often than hourly is refused when you turn it on (SCHEDULE_FINER_THAN_PLAN).

Turn a trigger off

# Remove by name (creating a trigger with the same name brings it back)
spl trigger remove daily-summary

# Or pause without removing (keeps the whole definition)
spl trigger pause daily-summary

Pairs with

On this page