Skip to main content
The 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

string
required
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:

string
required
The reminder/task message to display when triggered. If command is used, this describes what the command does.
integer
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”.
integer
Recurring interval in seconds (e.g., 3600 for every hour).Use this ONLY for recurring tasks like “every 2 hours” or “daily reminder”.
string
Cron expression for complex recurring schedules (e.g., “0 9 * * *” for daily at 9am).Use standard cron syntax: minute hour day month weekday
string
Optional: 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.
boolean
If true, send message directly to channel. If false, let agent process message for complex tasks. Default: true.

For “remove”, “enable”, “disable” actions:

string
required
The ID of the job to modify.

Returns

string
Confirmation message with job details or list of scheduled jobs.

Usage Examples

One-Time Reminder

Result: Reminder triggers in 10 minutes (600 seconds).

Recurring Task

Result: Task runs every hour.

Cron Expression

Result: Runs daily at 9:00 AM.

Scheduled Command

Result: Executes df -h every hour and reports output.

Schedule Types

One-Time (at_seconds)

Triggers once at a specific time in the future.
Common values:
  • 60 = 1 minute
  • 300 = 5 minutes
  • 600 = 10 minutes
  • 1800 = 30 minutes
  • 3600 = 1 hour
  • 86400 = 1 day
Internal storage: Converted to absolute timestamp in milliseconds.

Recurring (every_seconds)

Repeats at fixed intervals.
Common intervals:
  • 60 = Every minute
  • 300 = Every 5 minutes
  • 3600 = Every hour
  • 7200 = Every 2 hours
  • 86400 = Daily
  • 604800 = Weekly
Internal storage: Stored as milliseconds interval.

Cron Expression (cron_expr)

Uses standard cron syntax for complex schedules.
Examples:
Cron syntax:
  • * = any value
  • */n = every n units
  • n,m = specific values
  • n-m = range of values

Delivery Modes

Direct Delivery (deliver=true)

Message is sent directly to the chat channel without agent processing.
Use for:
  • Simple reminders
  • Notifications
  • Alerts

Agent Processing (deliver=false)

Message is processed by the agent, allowing complex task execution.
Use for:
  • Tasks requiring agent reasoning
  • Multi-step operations
  • Context-aware actions

Command Execution

When command is specified, it executes directly via the exec tool.
Behavior:
  • Executes shell command
  • Captures output (stdout + stderr)
  • Reports results to chat
  • Respects exec tool safety guards

Job Management

List Jobs

Output:

Remove Job

Result: "Cron job removed: job-123"

Enable Job

Result: "Cron job 'Check disk space' enabled"

Disable Job

Result: "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:
This ensures:
  • 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’s ExecuteJob method is called:

Execution Flow

  1. Command jobs: Execute via exec tool → Report output
  2. Direct delivery: Send message to channel immediately
  3. Agent processing: Route message through agent loop

Command Execution

Output format:
Error format:

Timeout Configuration

Commands timeout after the specified duration.

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 of message become the job name:

Integration Examples

Daily Report

System Monitoring

Meeting Reminders

Backup Verification