Jobs You Don't Schedule
Declarative YAML cron. Reliable pipelines that actually run. No infrastructure babysitting.
On this page
AI agents are reactive by default. They respond when you ask. But production AI needs to be proactive. Daily reports. Scheduled data syncs. Automated content publishing. Monitoring and alerts.
SystemPrompt provides declarative job scheduling. Define jobs in YAML. They run reliably.
The Problem
Building job scheduling infrastructure requires:
- Cron parsing: Interpreting cron expressions correctly
- Job execution: Running jobs in isolated contexts
- Failure handling: Retries, backoff, dead letter queues
- Monitoring: Job status, execution history, alerts
- Concurrency: Preventing duplicate runs, handling long-running jobs
- Persistence: Surviving restarts, maintaining state
Most teams use external services (AWS Lambda, Cloud Functions) or deploy separate job runners. More infrastructure to maintain.
The Solution
SystemPrompt includes a job scheduler:
Declarative Job Definition
Define jobs in YAML. Here's the real configuration from SystemPrompt:
# services/scheduler/config.yaml
scheduler:
enabled: true
jobs:
# Core jobs (defined in systemprompt-core)
- name: cleanup_anonymous_users
extension: core
job: cleanup_anonymous_users
schedule: "0 0 3 * * *" # 3 AM daily
enabled: true
- name: cleanup_empty_contexts
extension: core
job: cleanup_empty_contexts
schedule: "0 0 * * * *" # Hourly
enabled: true
- name: cleanup_inactive_sessions
extension: core
job: cleanup_inactive_sessions
schedule: "0 0 * * * *" # Hourly
enabled: true
- name: database_cleanup
extension: core
job: database_cleanup
schedule: "0 0 4 * * *" # 4 AM daily
enabled: true
- name: publish_content
extension: core
job: publish_content
schedule: "0 */30 * * * *" # Every 30 minutes
enabled: true
# Blog extension jobs
- name: content_ingestion
extension: blog
job: content_ingestion
schedule: "0 0 * * * *" # Hourly
enabled: true
Jobs reference extensions and job handlers. The cron format uses 6 fields (second, minute, hour, day, month, weekday).
Job Management CLI
# List all jobs
systemprompt infra jobs list
# Run a job manually
systemprompt infra jobs run daily_report
# View execution history
systemprompt infra jobs history
# Enable/disable jobs
systemprompt infra jobs enable content_sync
systemprompt infra jobs disable weekly_cleanup
Agent-Triggered Jobs
Schedule agents to run on a schedule:
# services/scheduler/agent-jobs.yaml
jobs:
morning_briefing:
cron: "0 8 * * 1-5" # Weekdays at 8 AM
agent: briefing-agent
message: "Generate today's briefing"
content_review:
cron: "0 10 * * *" # Daily at 10 AM
agent: content-reviewer
message: "Review yesterday's content for quality"
Reliable Execution
Jobs run reliably with:
- Automatic retries on failure
- Configurable timeout limits
- Execution locking (no duplicate runs)
- Detailed execution logs
Why This Matters for AI
Deterministic + Agentic
Some tasks need to run at specific times (deterministic). Others need AI reasoning (agentic). SystemPrompt combines both:
jobs:
data_collection:
cron: "0 */6 * * *" # Deterministic: every 6 hours
task: "data:collect_metrics"
analysis:
cron: "0 9 * * *"
agent: analyst # Agentic: AI analyzes the data
message: "Analyze yesterday's metrics and identify anomalies"
Proactive AI
Move from reactive to proactive AI:
- Morning briefings: AI summarizes what happened overnight
- Content scheduling: AI writes and publishes on a schedule
- Monitoring: AI reviews logs and alerts on issues
- Maintenance: AI cleans up, optimizes, and maintains
Workflow Orchestration
Chain jobs into workflows:
jobs:
step_1_collect:
cron: "0 6 * * *"
task: "pipeline:collect_data"
step_2_process:
cron: "0 7 * * *"
task: "pipeline:process_data"
depends_on: step_1_collect
step_3_report:
cron: "0 8 * * *"
agent: reporter
message: "Generate report from processed data"
depends_on: step_2_process
What You Skip
| Without SystemPrompt | With SystemPrompt |
|---|---|
| Cron daemon setup | YAML config |
| Job runner infrastructure | Built in |
| Retry logic | Automatic |
| Execution monitoring | Built in |
| Cloud function costs | Included |
| Separate deployment | Same platform |
Getting Started
Create a job in services/scheduler/:
# services/scheduler/my-jobs.yaml
jobs:
hello_world:
cron: "* * * * *" # Every minute
task: "example:hello"
enabled: true
# List jobs
systemprompt infra jobs list
# Run manually
systemprompt infra jobs run hello_world
# View history
systemprompt infra jobs history --job hello_world
See the Scheduler Reference for detailed configuration options.