Automation
Make your agent do things without you asking. Cron jobs, heartbeats, and scheduled tasks.
Why Automate?
Once your agent is running, you'll notice patterns:
- "I check the same thing every morning"
- "I want a daily summary"
- "I need the agent to monitor something"
That's where automation comes in.
Cron Jobs
OpenClaw has a built-in cron system. You define schedules in your agent's config, and the agent runs tasks automatically.
Setting Up a Cron Job
openclaw cron add --agent myagent Or define them in your agent's config file. A cron job needs:
- A schedule (cron syntax:
30 0 * * *= every day at 12:30 AM) - A prompt — what the agent should do when triggered
Example: Daily Summary
cron:
- name: daily-summary
schedule: "0 9 * * *" # 9 AM every day
prompt: "Give me a summary of yesterday's work and today's priorities." Example: System Health Check
cron:
- name: health-check
schedule: "0 */4 * * *" # Every 4 hours
prompt: "Check system health. Report any issues." Heartbeats
Heartbeats are simpler than cron jobs — they're periodic check-ins. If everything is fine, the agent replies HEARTBEAT_OK. If something needs attention, it speaks up.
This is great for monitoring: the agent only bothers you when there's a problem.
Practical Automation Ideas
| Task | Schedule | Description |
|---|---|---|
| Morning briefing | 9 AM daily | Summary of projects, calendar, priorities |
| Git backup | Midnight daily | Commit and push workspace changes |
| Server monitoring | Every 4 hours | Check disk, CPU, services |
| Content review | Weekly (Monday) | Review draft status, suggest next steps |
| Memory cleanup | Weekly | Review and consolidate memory files |
Tips
- Start simple. One daily cron job. See how it works before adding more.
- Watch the costs. Every cron trigger is an AI API call. Haiku/Flash models are great for routine checks.
- Use heartbeats for monitoring. They're designed for "only alert me if something's wrong."
- Check the logs. If a cron job isn't running:
openclaw logs --filter cron