Skip to main content

⏰ Scheduled Tasks

👤 Who it's for: Developers / DevOps
⏱️ Read time: ~6 minutes
💡 In one line: Tasks run on time, results arrive on time — no need to sit at the computer.

YingClaw has a built-in Cron scheduling system supporting Shell commands and AI Agent task execution on a schedule, with delivery to multiple messaging channels.

Task Types

TypeDescriptionUse Case
shellExecute Shell commandsSystem checks, data backups, scheduled scripts
agentExecute AI prompts (Agent tasks)Intelligent reports, data analysis, content creation

Three Scheduling Methods

1. Cron Expression

The most flexible scheduling method, supporting standard cron syntax:

# Daily at 9 AM
schedule: { kind: "cron", expr: "0 9 * * *" }

# Every hour
schedule: { kind: "cron", expr: "0 * * * *" }

# Weekdays at 6 PM
schedule: { kind: "cron", expr: "0 18 * * 1-5" }

2. Fixed Time (at)

Execute once at a specific moment:

schedule: { kind: "at", at: "2026-06-15T08:00:00Z" }

3. Interval (every)

Repeat at fixed intervals:

# Every 30 minutes
schedule: { kind: "every", every_ms: 1800000 }

# Every hour
schedule: { kind: "every", every_ms: 3600000 }

Delivery Channels

Task execution results can be pushed to the following channels:

ChannelConfiguration
TelegramSet delivery.channel: "telegram" and Chat ID
DiscordSet delivery.channel: "discord" and Channel ID
SlackSet delivery.channel: "slack" and Channel ID
WeChatSet delivery.channel: "weixin"
QQSet delivery.channel: "qq"

Core Tools

ToolFunction
cron_addCreate a new scheduled task
cron_listList all scheduled tasks
cron_updateModify an existing task's configuration
cron_removeDelete a specified task
cron_runManually trigger a task execution immediately

Use Cases

ScenarioTask TypeExample
Scheduled reportsagentDaily 9 AM: generate yesterday's summary and send to Telegram
Data monitoringshellHourly: check server CPU/memory/disk, alert on anomalies
NotificationsagentWeekly Friday PM: push project progress summary
Automated opsshellDaily 3 AM: clean up expired log files

Examples

Create a Scheduled Task

# Daily 9 AM report to Telegram
cron_add \
name="daily-report" \
job_type="agent" \
schedule='{"kind":"cron","expr":"0 9 * * *"}' \
prompt="Generate yesterday's work summary" \
delivery='{"mode":"announce","channel":"telegram","to":"YOUR_CHAT_ID"}'

Manage Scheduled Tasks

# List all tasks
cron_list

# Modify a task's schedule
cron_update job_id="xxx" patch='{"schedule":{"kind":"cron","expr":"0 10 * * *"}}'

# Trigger manually
cron_run job_id="xxx"

# Delete a task
cron_remove job_id="xxx"

Notes

  • 📋 Task results are logged by default, not pushed. Configure delivery for push notifications
  • ⏱️ Agent tasks have execution timeout limits — set timeout_secs parameter
  • 🔁 Avoid overly frequent tasks (e.g. every second) as they may impact performance
  • 🧹 Periodically clean up unused scheduled tasks to keep the list tidy

Next Steps

Scheduled tasks automate your operations. Next, explore 🌐 Browser Automation for web interaction capabilities.