Triggers

Triggers automate agent execution. Run agents on schedules, when files change, or via webhooks. No manual intervention needed.

Trigger Types

Cron Triggers

Run agents on a schedule using cron syntax:

ayo trigger create daily-report \ --cron "0 9 * * *" \ --agent @reporter \ --prompt "Generate daily status report"

This runs @reporter every day at 9am.

Cron Syntax

Field Values
Minute 0-59
Hour 0-23
Day of Month 1-31
Month 1-12
Day of Week 0-6 (Sunday=0)

Common Schedules

Schedule Cron
Every hour 0 * * * *
Daily at 9am 0 9 * * *
Weekdays at 6pm 0 18 * * 1-5
Monday at 8am 0 8 * * 1
First of month 0 0 1 * *

Watch Triggers

Run agents when files appear or change:

ayo trigger create invoice-processor \ --watch ~/Invoices/*.pdf \ --agent @processor \ --prompt "Process invoice: {{.path}}"

When a PDF appears in ~/Invoices/, @processor runs automatically. The file path is available as {{.path}}.

Webhook Triggers

Run agents via HTTP requests:

ayo trigger create slack-handler \ --webhook /slack/events \ --agent @slack-responder \ --prompt "Handle Slack event: {{.body}}"

Request body is available as {{.body}}.

Trigger Flows

Triggers can run entire flows, not just single agents:

ayo trigger create daily-digest \ --cron "0 18 * * 1-5" \ --flow team-digest

List Triggers

ayo trigger list

View Trigger Details

ayo trigger show daily-report

Delete a Trigger

ayo trigger delete daily-report

Example: Automated Document Pipeline

# Watch for new documents and process them ayo trigger create incoming-docs \ --watch ~/Incoming/*.pdf \ --flow document-pipeline \ --input '{"file": "{{.path}}"}'

Now any PDF dropped in ~/Incoming/ automatically goes through classification, extraction, validation, and filing.

Example: End-of-Day Reporting

# Generate daily summary at 5pm on weekdays ayo trigger create eod-summary \ --cron "0 17 * * 1-5" \ --agent @summarizer \ --prompt "Generate end-of-day summary for today's completed tickets"

Starting the Daemon

Triggers require the ayo daemon to be running:

ayo sandbox service start

The daemon manages sandboxes, monitors file watchers, and executes scheduled triggers.

Next Steps