Automation
Make OpenClaw proactive with cron jobs, background tasks, Task Flow, hooks, standing orders, heartbeat behavior, and external webhooks.
Automation turns OpenClaw from a reply bot into an agent system that can wake up, schedule work, react to events, and run background tasks.
Automation Surfaces
| Surface | Use it for |
|---|---|
| Cron jobs | Time-based scheduled work |
| Background tasks | Long-running or isolated work with status tracking |
| Task Flow | Multi-step orchestration above background tasks |
| Hooks | Event-driven lifecycle behavior |
| Webhooks | External systems triggering Gateway work |
| Standing orders | Permanent authority for recurring autonomous behavior |
| Heartbeat | Periodic check-ins and lightweight recurring action |
Cron Jobs
Cron is for predictable schedules:
openclaw cron create "0 8 * * 1-5" \
"Prepare my workday briefing: calendar, urgent email, weather, and open follow-ups." \
--name "morning-briefing" \
--session isolatedManage jobs:
openclaw cron list
openclaw cron show <job-id>
openclaw cron remove <job-id>Recent OpenClaw versions report cron state through the current storage layer rather than assuming a legacy jobs file. Prefer CLI commands over hand-editing runtime state.
Background Tasks
Background tasks track work that should continue beyond a single foreground turn. They are important for:
- isolated cron runs
- ACP harness sessions
- subagent work
- long CLI operations
- Task Flow steps
Use task status before assuming work failed:
openclaw tasks list
openclaw tasks show <taskId>Task Flow
Task Flow is the orchestration layer above background tasks. Use it when a workflow has multiple steps, checkpoints, or recoverable progress.
Good Task Flow candidates:
- research then draft then review
- deploy then verify then report
- classify inbox then prepare replies then request approval
- run checks then summarize failures then open follow-ups
Hooks
Hooks respond to OpenClaw events. A hook can run on lifecycle events, commands, session changes, outbound delivery, or other configured triggers.
Use hooks for:
- formatting reply payloads
- usage footers
- Slack outbound notifications
- custom audit trails
- workflow-specific post-processing
Inspect hooks through:
openclaw hooks list
openclaw hooks info <name>Webhooks
Webhooks let external systems wake OpenClaw:
- CI/CD notifications
- issue tracker events
- support queue events
- monitoring alerts
- Gmail Pub/Sub runners where configured
Keep webhook paths protected with tokens, bind locally when possible, and expose through a trusted reverse proxy or tunnel when remote access is required.
Standing Orders and Heartbeat
Standing orders define durable authority. Use them sparingly. A standing order should say what the agent may do, how often, with what data, and when it must ask.
Heartbeat is a periodic check-in. It is better for lightweight monitoring than exact schedules.
Example: Safe Email Triage
- Install/authorize the mail capability.
- Test read-only inbox search.
- Create labels manually.
- Schedule a cron job that classifies new messages.
- Draft replies but require confirmation before sending.
- Add a usage footer or summary hook if desired.
openclaw cron create "*/20 * * * *" \
"Review new unread mail since the last run. Label only. Draft replies for action-required items, but do not send." \
--name "email-triage" \
--session isolatedFailure Modes
Watch for:
- cron jobs using stale credentials
- background tasks still running after the user assumes they stopped
- hooks that modify replies unexpectedly
- webhooks reachable without enough auth
- standing orders that are too broad
- automation using a powerful
mainsession when an isolated session would be safer
Proactive agent design
Automation needs authority boundaries. A good recurring task specifies trigger, session, tools, credentials, output channel, and stop conditions before it runs unattended.
Continue with practice
You have finished the core ideas of Automation.
If you want to turn the idea into something reusable, continue practicing on AgentWay.