Master OpenClaw Automation: Choose the Right Mechanism
Managing agents manually is a drag. You want your tools to work for you while you sleep, whether that’s checking your email or running a report every Monday. OpenClaw gives you several ways to automate these tasks, but it isn’t always obvious which one to pick.
This guide breaks down the different automation styles so you can get your setup running without the guesswork.
Quick decision guide
Section titled “Quick decision guide”flowchart TD A{Run on a schedule?} -->|Yes| B{Exact timing needed?} A -->|No| C{React to events?} B -->|Yes| D[Cron] B -->|No| E[Heartbeat] C -->|Yes| F[Hooks] C -->|No| G[Standing Orders]Mechanisms at a glance
Section titled “Mechanisms at a glance”| Mechanism | What it does | Runs in | Creates task record |
|---|---|---|---|
| Heartbeat | Periodic main-session turn — batches multiple checks | Main session | No |
| Cron | Scheduled jobs with precise timing | Main or isolated session | Yes (all types) |
| Background Tasks | Tracks detached work (cron, ACP, subagents, CLI) | N/A (ledger) | N/A |
| Hooks | Event-driven scripts triggered by agent lifecycle events | Hook runner | No |
| Standing Orders | Persistent instructions injected into the system prompt | Main session | No |
| Webhooks | Receive inbound HTTP events and route to the agent | Gateway HTTP | No |
Specialized automation
Section titled “Specialized automation”| Mechanism | What it does |
|---|---|
| Gmail PubSub | Real-time Gmail notifications via Google PubSub |
| Polling | Periodic data source checks (RSS, APIs, etc.) |
| Auth Monitoring | Credential health and expiry alerts |
How they work together
Section titled “How they work together”Most effective setups use a mix of these tools. Here is how they usually fit into a workflow:
- Heartbeat handles routine monitoring (inbox, calendar, notifications) in one batched turn every 30 minutes.
- Cron handles precise schedules (daily reports, weekly reviews) and one-shot reminders.
- Hooks react to specific events (tool calls, session resets, compaction) with custom scripts.
- Standing Orders give the agent persistent context (“always check the project board before replying”).
- Background Tasks automatically track all detached work so you can inspect and audit it.
See Cron vs Heartbeat for a detailed comparison of the two scheduling mechanisms.
Older ClawFlow references
Section titled “Older ClawFlow references”Older release notes and docs may mention ClawFlow or openclaw flows, but the current CLI surface in this repo is openclaw tasks.
See Background Tasks for the supported task ledger commands, plus ClawFlow and CLI: flows for compatibility notes.
Related
Section titled “Related”- Cron vs Heartbeat — detailed comparison guide
- ClawFlow — compatibility note for older docs and release notes
- Troubleshooting — debugging automation issues
- Configuration Reference — all config keys
Next steps
Section titled “Next steps”If you are ready to start building, I recommend checking out the Cron vs Heartbeat guide first. It helps you decide how to handle your recurring tasks. You can also look at Background Tasks to see how to manage your work once it is running.
OpenClaw Expert
Still stuck?
If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.