Scheduling enables agents to run automatically on time-based schedules, from simple recurring tasks to complex time-orchestrated workflows, ensuring critical operations happen exactly when needed.
Overview
The Scheduling primitive allows you to execute agents at specified times using cron expressions, intervals, or custom schedules. Whether you need daily reports, hourly data syncs, or one-time future executions, scheduling makes it effortless to automate time-based operations. Scheduling is essential for:- Recurring Tasks: Run agents daily, weekly, monthly, or custom intervals
- Batch Processing: Process data during off-peak hours
- Regular Reports: Generate and distribute reports on schedule
- Maintenance Operations: Perform cleanup and optimization tasks
- Time-Based Triggers: Execute agents at specific times or dates
- Multi-Region Coordination: Schedule across different time zones
Cron Expressions
Use familiar cron syntax for flexible scheduling
Time Zones
Schedule in any time zone with automatic DST handling
One-Time Schedules
Execute agents at a specific future time
Smart Retries
Automatic retry for missed or failed executions
How Scheduling Works
When you schedule an agent:- Definition: Schedule created with cron expression or specific time
- Registration: Schedule registered with execution engine
- Monitoring: System continuously monitors scheduled times
- Execution: Agent executes automatically at scheduled time
- Completion: Results logged and next execution calculated
- Repeat: Process repeats for recurring schedules
Guaranteed Execution: Schedules use at-least-once execution semantics. Missed executions are caught up automatically.
Schedule Types
Cron Schedules
Interval Schedules
One-Time Schedules
Complex Schedules
Code Examples
Basic Cron Schedule
Interval Schedule
One-Time Execution
Business Hours Schedule
Monthly Schedule
Complex Multi-Schedule
Schedule with Conditions
Manage Schedules
Use Cases
1. Daily Reporting
Automate daily business reports:2. Data Synchronization
Sync data between systems:3. System Maintenance
Schedule maintenance tasks:4. Content Publishing
Schedule content distribution:5. Compliance and Auditing
Regular compliance checks:6. Customer Engagement
Automated customer touchpoints:Best Practices
Cron Expression Tips
Common Cron Patterns
Common Cron Patterns
Test Cron Expressions
Test Cron Expressions
Use Named Time Zones
Use Named Time Zones
Schedule Management
Set Execution Windows
Set Execution Windows
Configure Retries
Configure Retries
Handle Overlapping Executions
Handle Overlapping Executions
Set Expiration
Set Expiration
Performance
Off-Peak Scheduling
Off-Peak Scheduling
Stagger Executions
Stagger Executions
Monitor Resource Usage
Monitor Resource Usage
Integration with Other Primitives
With Workflow
Schedule workflow executions:With Tasks
Create scheduled task generation:With Memory
Remember schedule execution context:Performance Considerations
Execution Precision
- Cron Schedules: ±1 second precision
- Interval Schedules: ±100ms precision
- One-Time Schedules: ±1 second precision
Scalability
- Concurrent Schedules: Thousands of active schedules
- Execution Rate: Thousands of executions per minute
- Time Zone Support: All IANA time zones
Cost Optimization
Troubleshooting
Schedule Not Running
Schedule Not Running
Problem: Schedule created but not executingSolutions:
- Verify schedule is active/enabled
- Check cron expression is valid
- Verify time zone is correct
- Review execution history for errors
- Check for conflicting schedules
Missed Executions
Missed Executions
Problem: Schedules being skippedSolutions:
- Enable catch-up for missed executions
- Increase execution window
- Check system load during scheduled time
- Review concurrency settings
- Verify timeout isn’t too short
Time Zone Issues
Time Zone Issues
Problem: Schedule running at wrong timeSolutions:
- Verify time zone string is correct
- Check for DST transitions
- Use UTC for consistency
- Test schedule with multiple dates
Overlapping Executions
Overlapping Executions
Problem: New execution starting while previous still runningSolutions:
- Increase timeout
- Set concurrency policy to skip
- Optimize agent execution time
- Reduce schedule frequency
Advanced Patterns
Dynamic Scheduling
Adjust schedule based on conditions:Schedule Dependencies
Chain schedules:Holiday Handling
Skip holidays automatically:Related Primitives
Trigger
Event-driven agent execution
Workflow
Schedule complex workflows
Background
Run scheduled agents asynchronously
Tasks
Create scheduled task generation
Additional Resources
API Reference
Complete scheduling API documentation
Cron Guide
Cron expression syntax and examples
Time Zones
Supported time zones and DST handling