Skip to main content

Automation

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

Quick decision guide

Mechanisms at a glance

MechanismWhat it doesRuns inCreates task record
HeartbeatPeriodic main-session turn — batches multiple checksMain sessionNo
CronScheduled jobs with precise timingMain or isolated sessionYes (all types)
Background TasksTracks detached work (cron, ACP, subagents, CLI)N/A (ledger)N/A
HooksEvent-driven scripts triggered by agent lifecycle eventsHook runnerNo
Standing OrdersPersistent instructions injected into the system promptMain sessionNo
WebhooksReceive inbound HTTP events and route to the agentGateway HTTPNo

Specialized automation

MechanismWhat it does
Gmail PubSubReal-time Gmail notifications via Google PubSub
PollingPeriodic data source checks (RSS, APIs, etc.)
Auth MonitoringCredential 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.
See Cron vs Heartbeat for a detailed comparison of the two scheduling mechanisms.