What Are Heartbeats?
Heartbeats are periodic check-ins where your OpenClaw agent wakes up and does useful background work — even when you haven't asked it anything.
How They Work
At configured intervals, OpenClaw sends a heartbeat prompt to your agent. The agent reads HEARTBEAT.md and decides what to do:
- Something needs attention? → Send you a message
- Nothing new? → Reply
HEARTBEAT_OKand go back to sleep
Master this topic with hands-on labs
Go beyond reading — build real projects in sandboxed environments with expert video guidance.
Browse Courses →Configuring HEARTBEAT.md
# HEARTBEAT.md
## Checks (rotate through these)
- [ ] Check email for urgent messages
- [ ] Review calendar for upcoming events (next 24h)
- [ ] Check website uptime for copypastelearn.com
- [ ] Weather forecast if rain expected
## Rules
- Only alert for genuinely important things
- Quiet hours: 23:00 - 08:00 (don't disturb)
- If nothing important, reply HEARTBEAT_OKHeartbeats vs Cron
OpenClaw also supports cron jobs. When to use each:
| Feature | Heartbeats | Cron |
|---|---|---|
| Timing | Approximate (every ~30min) | Exact (9:00 AM sharp) |
| Context | Has recent chat history | Isolated session |
| Batching | Multiple checks per beat | One task per job |
| Model | Uses main session model | Can use different model |
Rule of thumb: Use heartbeats for batched periodic checks, cron for precise schedules.
Tracking State
Use memory/heartbeat-state.json to avoid redundant checks:
{
"lastChecks": {
"email": 1703275200,
"calendar": 1703260800,
"weather": null
}
}The agent checks timestamps and skips recently-completed tasks.
Get weekly IT automation tips
Docker, Ansible, Terraform, MLOps — curated insights delivered to your inbox. No spam.
Subscribe Free →Practical Examples
Email Monitor
## Email Check
- Look for unread emails from VIP senders
- Summarize anything marked urgent
- Skip newsletters and marketingCalendar Alert
## Calendar
- Alert 2 hours before any meeting
- Include video call links if available
- Mention if preparation is neededInfrastructure Monitor
## Infra
- Ping copypastelearn.com
- Check SSL certificate expiry
- Alert if any service is downBest Practices
- Keep HEARTBEAT.md small — it's read every interval, burning tokens
- Rotate checks — don't run everything every heartbeat
- Respect quiet hours — nobody wants 3 AM alerts
- Track state — avoid redundant API calls
- Be selective — only alert on genuinely important things
---
Ready to go deeper? Check out our hands-on course: OpenClaw Agent — practical exercises you can follow along on your own machine.
Related
For a production-focused walkthrough, see Luca Berton's guide on agentic Ansible automation with OpenClaw.
Ready to learn by doing?
Stop reading tutorials — start building. Expert video courses with hands-on labs in real sandboxed environments.
Related Articles
OpenClaw Cron Jobs: Scheduled AI Tasks
Schedule recurring tasks with OpenClaw cron — from daily summaries to weekly reports. Complete setup guide with practical examples.
OpenClaw + Ansible Automation
Combine OpenClaw's AI agent with Ansible for intelligent infrastructure automation — writing playbooks, debugging tasks, and orchestrating deployments.
OpenClaw Volume Permissions Fix
Fix OpenClaw Docker volume permission errors. Resolve EACCES issues for named volumes and bind mounts with troubleshooting steps.
Understanding OpenClaw's Memory System
Learn how OpenClaw agents maintain memory across sessions using file-based persistence — daily notes, MEMORY.md, and workspace context.
OpenClaw Node Pairing
Pair your phone or IoT devices with OpenClaw for camera access, location tracking, screen recording, and remote commands.
OpenClaw on Raspberry Pi
Run an OpenClaw AI agent on a Raspberry Pi for a low-power, always-on personal assistant. Complete setup guide with performance tips.
Explore topics
Browse more articles on the topics covered here.