openclaw/docs/automation/index.md

3.9 KiB

summary read_when title
Overview of all automation mechanisms: heartbeat, cron, tasks, hooks, webhooks, and more
Deciding how to automate work with OpenClaw
Choosing between heartbeat, cron, hooks, and webhooks
Looking for the right automation entry point
Automation Overview

Automation

OpenClaw provides several automation mechanisms, each suited to different use cases. This page helps you choose the right one.

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

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

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

The most effective setups combine multiple mechanisms:

  1. Heartbeat handles routine monitoring (inbox, calendar, notifications) in one batched turn every 30 minutes.
  2. Cron handles precise schedules (daily reports, weekly reviews) and one-shot reminders.
  3. Hooks react to specific events (tool calls, session resets, compaction) with custom scripts.
  4. Standing Orders give the agent persistent context ("always check the project board before replying").
  5. Background Tasks automatically track all detached work so you can inspect and audit it.
  6. ClawFlow groups related detached tasks into a single flow when the work needs a higher-level job view.

See Cron vs Heartbeat for a detailed comparison of the two scheduling mechanisms.

ClawFlow

ClawFlow sits above Background Tasks. Tasks still track the detached runs, while ClawFlow groups related task runs into one job that you can inspect or cancel from the CLI.

See ClawFlow for the flow overview and CLI: flows for the command surface.