Clawdbot Cron Jobs

Schedule automated tasks with Clawdbot AI assistant cron jobs. Learn how to configure recurring messages, reports, and automated workflows.

Clawdbot Cron Jobs Overview

Clawdbot supports scheduled tasks using cron-style syntax. Cron jobs enable automated messages, periodic reports, health checks, and recurring workflows.

Configuration

Basic Cron Job

{
  "cron": {
    "jobs": [
      {
        "id": "daily-summary",
        "schedule": "0 9 * * *",
        "action": "send_message",
        "target": {
          "channel": "whatsapp",
          "peer": "+15551234567"
        },
        "message": "Good morning! Here's your daily summary."
      }
    ]
  }
}

Cron Syntax

FieldValuesDescription
Minute0-59Minute of hour
Hour0-23Hour of day
Day1-31Day of month
Month1-12Month of year
Weekday0-6Day of week (0=Sunday)

Common Schedules

ScheduleCron Expression
Every hour0 * * * *
Daily at 9am0 9 * * *
Weekly Monday0 9 * * 1
Monthly 1st0 9 1 * *

Job Types

Message Jobs

Send scheduled messages:

{
  "id": "reminder",
  "schedule": "0 8 * * 1-5",
  "action": "send_message",
  "target": {
    "channel": "telegram",
    "peer": "123456789"
  },
  "message": "Start of workday reminder!"
}

Agent Jobs

Run agent tasks:

{
  "id": "daily-report",
  "schedule": "0 18 * * *",
  "action": "run_agent",
  "agentId": "reporter",
  "prompt": "Generate today's activity report"
}

Webhook Jobs

Trigger webhooks:

{
  "id": "health-check",
  "schedule": "*/5 * * * *",
  "action": "webhook",
  "url": "https://api.example.com/health",
  "method": "POST"
}

Session Handling

Cron Session Keys

Cron jobs use dedicated sessions:

cron:<job.id>

Session Isolation

  • Each job has its own session
  • History persists across runs
  • Context carries over

Job Management

CLI Commands

# List cron jobs
clawdbot cron list

# Add a job
clawdbot cron add --id daily --schedule "0 9 * * *" --action send_message

# Remove a job
clawdbot cron remove daily

# Run job immediately
clawdbot cron run daily

Job Status

StatusDescription
activeJob is scheduled
pausedJob is paused
runningCurrently executing
failedLast run failed

Error Handling

Retry Policy

{
  "cron": {
    "retry": {
      "maxAttempts": 3,
      "backoff": "exponential",
      "initialDelay": 1000
    }
  }
}

Failure Notifications

{
  "cron": {
    "notifications": {
      "onFailure": {
        "channel": "telegram",
        "peer": "admin_id"
      }
    }
  }
}

Timezone

Configuration

{
  "cron": {
    "timezone": "Asia/Shanghai"
  }
}

Default Behavior

  • Uses system timezone if not specified
  • All schedules interpreted in configured timezone

Examples

Daily Standup Reminder

{
  "id": "standup",
  "schedule": "0 9 * * 1-5",
  "action": "send_message",
  "target": {
    "channel": "discord",
    "peer": { "kind": "group", "id": "standup-channel" }
  },
  "message": "Time for daily standup! What did you work on yesterday?"
}

Weekly Report

{
  "id": "weekly-report",
  "schedule": "0 17 * * 5",
  "action": "run_agent",
  "agentId": "main",
  "prompt": "Generate weekly summary report and send to team channel"
}

Next Steps