Architecture
Routine Types
Lightweight
Single LLM call, no tools. Fast and cheap for checks and notifications.
Full Job
Multi-turn execution with tool access. For complex automation tasks.
Trigger Types
Cron Schedule
Fire on a recurring schedule:- Standard cron:
0 9 * * MON-FRI(9am weekdays) - Human-readable:
every 2h,every monday at 9am - Shortcuts:
@hourly,@daily,@weekly
Event Pattern
Fire when a channel message matches a regex:(?i)keyword- Case-insensitive match\b(word1|word2)\b- Word boundary match^deploy.*prod- Starts with “deploy”, contains “prod”
Webhook
Fire on incoming HTTP POST:http://your-host/hooks/routine/{id} or http://your-host/hooks/routine/{path}
Manual
Fire only via tool call or CLI:Execution Modes
Lightweight
Single LLM call with context injection, no tool access:- Periodic health checks
- Notification summarization
- Simple decision logic
- Read-only operations
Full Job
Multi-turn agent loop with full tool access:- Complex automation
- Multi-step workflows
- Tool-heavy operations
- File manipulation
Guardrails
Routines enforce safety constraints:Cooldown
Minimum time between fires:Max Concurrent
Limit simultaneous runs of the same routine:Dedup Window
For event triggers, ignore duplicate content:Notification Config
Control when and how users are notified:Quiet Hours
Suppress notifications during sleep hours:Creating Routines
Via CLI
Via Tool
Example Routine Definitions
Heartbeat Monitor
Heartbeat Monitor
Emergency Responder
Emergency Responder
GitHub Webhook Deploy
GitHub Webhook Deploy
Daily Standup
Daily Standup
Engine Implementation
The routine engine runs two independent loops:Cron Ticker
Event Matcher
Execution Flow
- Trigger fires (cron, event, webhook, manual)
- Guardrail checks (cooldown, max_concurrent, dedup)
- Global capacity check (max_concurrent_routines)
- Spawn execution
- Lightweight: Single LLM call
- Full Job: Delegate to scheduler
- Record result (success/failure, message, iterations)
- Notify user (if configured)
- Update next_fire_at (for cron triggers)
Database Schema
Configuration
Monitoring
Next Steps
Sandbox
Learn about Docker-based job execution
API Reference
API documentation for routines
