cron tool provides comprehensive scheduling capabilities for agents, supporting one-time reminders, recurring tasks, and automated command execution.
cron
Schedule reminders, tasks, or system commands.Parameters
Action to perform:
"add"- Create a new scheduled job"list"- List all scheduled jobs"remove"- Delete a job"enable"- Enable a disabled job"disable"- Temporarily disable a job
For “add” action:
The reminder/task message to display when triggered. If
command is used, this describes what the command does.One-time reminder: seconds from now when to trigger (e.g., 600 for 10 minutes later).Use this for one-time reminders like “remind me in 10 minutes”.
Recurring interval in seconds (e.g., 3600 for every hour).Use this ONLY for recurring tasks like “every 2 hours” or “daily reminder”.
Cron expression for complex recurring schedules (e.g., “0 9 * * *” for daily at 9am).Use standard cron syntax:
minute hour day month weekdayOptional: Shell command to execute directly (e.g., “df -h”).If set, the agent will run this command and report output instead of just showing the message.
deliver will be forced to false for commands.If true, send message directly to channel. If false, let agent process message for complex tasks. Default: true.
For “remove”, “enable”, “disable” actions:
The ID of the job to modify.
Returns
Confirmation message with job details or list of scheduled jobs.
Usage Examples
One-Time Reminder
Recurring Task
Cron Expression
Scheduled Command
df -h every hour and reports output.
Schedule Types
One-Time (at_seconds)
Triggers once at a specific time in the future.- 60 = 1 minute
- 300 = 5 minutes
- 600 = 10 minutes
- 1800 = 30 minutes
- 3600 = 1 hour
- 86400 = 1 day
Recurring (every_seconds)
Repeats at fixed intervals.- 60 = Every minute
- 300 = Every 5 minutes
- 3600 = Every hour
- 7200 = Every 2 hours
- 86400 = Daily
- 604800 = Weekly
Cron Expression (cron_expr)
Uses standard cron syntax for complex schedules.*= any value*/n= every n unitsn,m= specific valuesn-m= range of values
Delivery Modes
Direct Delivery (deliver=true)
Message is sent directly to the chat channel without agent processing.- Simple reminders
- Notifications
- Alerts
Agent Processing (deliver=false)
Message is processed by the agent, allowing complex task execution.- Tasks requiring agent reasoning
- Multi-step operations
- Context-aware actions
Command Execution
Whencommand is specified, it executes directly via the exec tool.
- Executes shell command
- Captures output (stdout + stderr)
- Reports results to chat
- Respects exec tool safety guards
Job Management
List Jobs
Remove Job
"Cron job removed: job-123"
Enable Job
"Cron job 'Check disk space' enabled"
Disable Job
"Cron job 'Check disk space' disabled"
Disabled jobs are not deleted but won’t execute until re-enabled.
Context Management
Jobs inherit context from the conversation where they’re created:- Job messages are sent to the original channel
- Job output reaches the correct user
- Multi-user agents maintain proper routing
Job Execution
When a job triggers, the cron tool’sExecuteJob method is called:
Execution Flow
- Command jobs: Execute via exec tool → Report output
- Direct delivery: Send message to channel immediately
- Agent processing: Route message through agent loop
Command Execution
Timeout Configuration
Error Handling
Missing Parameters
Invalid Schedule
Missing Context
Job Not Found
Add Job Failure
Best Practices
1. Choose the Right Schedule Type
2. Provide Descriptive Messages
3. Use Commands for Simple Operations
4. List Jobs Regularly
Prevent accumulation of obsolete jobs:5. Use Meaningful Job Names
The first 30 characters ofmessage become the job name: