On this page
On this page
Automation
Manage automations
Day-to-day operation of stored jobs: copy-ready CLI examples, the management commands, run history semantics, and the cron.* configuration keys. Part of the Automations guide.
In the Control UI, Start now starts an automation immediately. Open Activity history to review its activity. Delete removes the automation and stops future activity; the confirmation explains that this can’t be undone. An automation’s owner needs automation access to edit it. Admins can also edit it.
Before upgrading, run openclaw cron list --all --json and note the id of
each job whose human owner has left. On releases that show ownerProfileId,
use openclaw users list to look up the profile. After upgrading, run
openclaw doctor --fix to save the recorded creator profile on older jobs that
lack an explicit owner. Doctor backs up the store and preserves existing
transfers and tool restrictions.
A deleted owner stops the next scheduled run or watcher launch. An administrator
can open the affected job on Automations, select an existing Owner, and
save. An active job stays with its current owner and runs on schedule until the
recipient opens the job and selects Accept and use my account. The handoff
keeps its ID and next run, switches execution to the recipient, and stops an
in-flight run from using the former owner’s access. Paused jobs transfer paused;
the recipient can enable them later. An old owner’s personal model pin does not transfer.
To verify the repair when it is safe to run the job, use
openclaw automations run <jobId> --wait with the same ID.
When an agent or Template creates an automation in chat, the card appears as soon as the save is confirmed, even if the assistant is still working. Plans and failed attempts do not show a card. A saved automation says Created until its settings load, then shows the link and current on/off switch. You can pause or resume a saved automation from the conversation if you have permission to edit it. If the automation is removed or you lose access to it, the card keeps its name but no longer offers any actions.
Deleting a conversation does not remove its linked automations. Command automations can continue running after their creating conversation is deleted. The conversation's deletion confirmation warns that automations may continue; disable or remove them separately to stop future runs.
Run links from automation messages and notifications open the exact recorded run, even when newer runs fill the first history page. Choose Show all activity to return to that automation's full history. Links with a reused session or start-time identity do not select an ambiguous run.
CLI examples
One-shot reminder
Recurring isolated job
Model and thinking override
Webhook output
Command output
Managing jobs
In the Automations editor, Prompt preview shows how the draft looks with Markdown formatting. New automations start active. Under Advanced, you can turn off Turn on after creating to save a paused draft, or turn off Delete after it runs to keep a one-time automation after it succeeds.
In the Control UI, an open automation refreshes its next-run time and condition activity when scheduler events arrive. These runtime updates preserve unsaved settings and the saved definition used for conflict detection, including when the selected automation is outside the current list page or filter.
Model choices load when you open an automation's settings or create an automation. You can edit the draft while choices load. Model-catalog errors appear in that editor without interrupting the automation list or run history.
Conversational management
Any turn admitted with operator.admin can ask the agent to list, inspect, update, run, or remove any existing automation on that Gateway, regardless of its creator or channel. That includes the owner on any Gateway client (Control UI, native app, CLI, or a local client of a gateway.auth.mode: "none" Gateway), an administrator, and a verified channel sender listed in commands.ownerAllowFrom, also when that sender is linked to a personal profile. An unlisted channel sender linked to a personal profile gets that profile's access. For example, ask it to disable a reminder created in Telegram. This matches the administrator's authority on the Automations page. Create command payloads through the operator CLI or Gateway API.
When tools.gatewayPolicy.automations.scope is "caller", model turns keep ordinary caller scope even for administrators and configured channel owners. allowCommandJobs: false additionally blocks model changes to and runs of command jobs. Direct human administration remains available. See Gateway tool policy.
Administrators can create recurring jobs in chat, including jobs with timeoutSeconds: 0. With operator.cron or operator.write, you can create personal automations in chats you own or created. You can edit an automation you own or created from any chat, including someone else’s. Switching chats does not redirect delivery or transfer execution authority. Remote administration does not grant local-host or provider-read authority, or permission to capture fresh configured-MCP execution authority. An incomplete tool capture still prevents inheriting an uncaptured tool surface.
The Gateway grants this authority once, when the turn is admitted. Each operation uses a one-use grant that expires after 60 seconds and remains bound to that exact active run. Channel owner membership is rechecked against the current global owner list when the capability is used and immediately before a mutation commits. Channel allowlists, wildcard entries, display names, account IDs, and session routes do not establish ownership. Turns without operator.admin receive no management grant. If access is denied or a grant expires, retry from a fresh owner or administrator turn, or use the Automations page.
After sessions_yield, a verified requester continuation keeps its personal scheduling and existing management rights, not fresh host or app privileges. The old run’s grants expire. A former creator can reschedule a transferred watch without stopping it; changing what runs saves it paused for its current owner. Removing the channel sender from the global owner list, cancellation, session reset or archive, a new direct user turn, and Gateway restart invalidate the handoff. Ordinary inter-session messages and child results do not grant management access.
Each admin management request records its method, run, operational instance, and success or failure in the Gateway's cron: admin management log, alongside the ordinary tool audit record. Management authority does not transfer creator attribution or replace the job's scheduled execution policy.
CLI management
For older automations missing creator account metadata, run openclaw doctor --fix.
Doctor reconciles the account only when the stored creator identity proves it,
and reports the repair. The matching creator session can then update an agent
prompt without supplying a new tool cap. Existing tool permissions and creator
attribution stay intact; capless jobs retain their legacy execution policy.
An explicit permission edit still requires matching owner authority. Jobs whose
stored identity cannot prove an account need authenticated administrator recovery;
Doctor does not infer ownership from delivery settings or the current caller.
Automations created before owner attribution have no recorded owner. An authenticated administrator or configured channel owner can edit them through chat, including their prompt, model, and tool cap. Management keeps an operator automation’s execution authority and attribution; it does not adopt the administrator’s conversation as a new owner. Ordinary caller-scoped turns cannot edit ownerless operator automations.
An operator-created automation can also have an owner conversation. That chat can list, enable, disable, reschedule, run or remove it. Other chats do not inherit that access, but the automation's human owner or creator can still edit it there. Timing changes keep existing execution permissions. Changing what the automation runs from a caller-scoped chat narrows operator permissions to the job's account; it does not move the job to the chat used to edit it. Only a Gateway owner, an operator or the automation's own runs can write its scratch.
Conversation automation views use the conversation's physical key and selected agent. With session.scope: "global", jobs targeting session:global or that agent's main-session alias belong to its global conversation. An explicitly agent-qualified named target remains separate, and another agent's global conversation keeps its own jobs.
Archiving a session (Control UI, or sessions.patch { key, archived: true, expectedSessionId } using the durable ID from sessions.list) disables every enabled automation job bound to that session: its isolated cron:<jobId> session, a session:<key> target, or a delivery/wake sessionKey lane. Restoring the session requires the same observed identity and does not re-enable those jobs; use openclaw automations enable <jobId>. Sessions with an enabled bound job show a clock badge in the Control UI sidebar. An agent's main session, including global, cannot be archived.
Before archiving or deleting a session with an enabled bound job, the Control UI asks for confirmation. The dialog names linked jobs and offers Archive anyway or Delete anyway. For deletion, it warns that automations may keep running and should be disabled or removed separately. The warning appears even if you turned off delete confirmations. Archiving a nested session tree lists the jobs bound to any session in the tree. Sessions without a bound job archive and delete as before. The browser console records each warning as [session-automation-confirm] <archive|delete> shown, followed by confirmed or cancelled.
openclaw automations run <jobId> returns after enqueueing the manual run. Use --wait for shutdown hooks, maintenance scripts, or other automation that must block until the queued run finishes; it polls the returned runId (default timeout 10m, poll interval 2s) and exits 0 only for completionStatus: "succeeded". Failed or unknown completion and wait timeouts exit non-zero.
The agent automations tool's run action waits in the Gateway instead: it returns the finished run (status, error, delivery status, and summary) when the run ends within the call's timeoutMs (default 60 seconds, capped at 10 minutes). A longer run returns its runId; read it later with the runs action and that runId. Main-session jobs, and jobs that run in the calling session, return at once because they start only after the calling turn ends. With global session scope, this includes session:global and main-session aliases for the calling agent. Quiet jobs targeting another agent's global conversation retain the normal bounded wait.
Run-now delivery measures lateness from when the manual request was accepted. An old pending scheduled slot does not make its fresh output stale; automatic and --due runs keep the original scheduled time for that check. A manual run still preserves the job's recurring cadence or future one-shot occurrence.
Running a paused future one-shot leaves it paused and keeps its saved occurrence. Re-enable it when automatic execution is wanted. If a manual run was accepted before the scheduled time but waited past it in the command queue, that occurrence remains available after re-enabling or restarting the Gateway.
Run history keeps payload execution in status (ok, error, or skipped) and whole-run completion in completionStatus (succeeded, failed, or unknown). Requested delivery is required unless the admitted job explicitly sets delivery.bestEffort: true; delivery-only failure leaves execution status: "ok", does not increment execution error counters or enter retry backoff, and records completionStatus: "failed". An adapter send without a delivery identity stays unknown, without an automatic resend that could duplicate the message.
Once a successful one-shot consumes its scheduled occurrence, its finished event and run history omit nextRunAtMs, including when the job auto-deletes. An early manual run that preserves a future occurrence still reports that occurrence.
Control UI run history shows OK · Error or OK · Unknown when execution succeeded but whole-run completion failed or remains unknown. Its status filter still selects the execution status.
An isolated agent turn can qualify for Run this automation as a script? when its entire alert decision is one comparison against one command's numeric output. For example: “Run cat disk.txt. If usage is at or above 85, say so. Otherwise reply NO_REPLY.” The rule can refer to the reading directly, or use a metric name that its alert format explicitly binds to the reading: Alert if the salinity is above 3%. For an alert, say "Salinity: N%." with N replaced by the reading. A numeric example reply is wording, not a second limit.
The comparison recognizes directions for making one call, using its result, and returning the reply. When the limit has units, the instructions must place the unconverted reading in the alert in those same units. At least two distinct alert readings must demonstrate that format, and every recorded alert must match exactly. For example, past alert decisions alone do not establish that a temperature reading is in Celsius rather than Fahrenheit. An exception, another decision, or unrecognized wording leaves the job on the agent.
Each run records its instruction and tool version. Qualifying runs must all use the same replayable exec call and print just one number. Recording the outcome with automations (record_result) doesn't count as another tool call. The comparison preserves command, workdir, env, and timeoutSeconds; a display title or yield interval doesn't affect the decision. Both alerts and quiet runs must appear. At least four more runs must agree after both outcomes have appeared, and no compared run may lack its reading. The offer shows average tokens per checked run. If the job consistently recorded a dashboard outcome for an alert or quiet check, the script preserves that outcome. The offer is withheld when identical decisions produced different kinds of recorded results.
Switch to script replaces the agent turn with a script payload that repeats the same exec call, compares the number using the instructed limit, and preserves the alert text. A prescribed literal stays literal; N changes only when the instructions mark it as the reading. Without prescribed wording, at least two distinct alert readings must demonstrate one consistent template. There is no invented fallback message. Schedule and delivery stay as they were, and the script may use only exec.
An automation configured to skip runs when its scratch is empty stays on the agent. A script would otherwise run even after the scratch was cleared.
A saved job timeout carries over unchanged if it is a whole number from 1 to 900 seconds. No offer appears for an unlimited (0), fractional, or longer timeout. With no saved timeout, switching uses the normal 300-second script default.
No offer appears when the Gateway would refuse the script: for automations with a condition trigger, when cron.triggers.enabled is false, or when host execution is disabled. A parent-bound isolated agent turn gets no automatic offer: a headless script cannot inherit the parent's workspace, working directory, sandbox, or access lifetime. Binding a parent changes the job revision, so a previously displayed offer cannot be applied. You can still deliberately replace the payload with a script in the editor. An offer applies only to the version of the automation it was made for. Editing the instructions or tools starts the comparison over. Gateway clients read the offer as scriptOffer on a cron.runs response for one job.
After each run, the Gateway also records whether the automation qualifies in the job's state.scriptOffer (with tokensPerRun when runs reported usage), and the Control UI Inbox lists each such automation once, linking to its offer. Any edit to the automation clears it.
A scheduled run can use the automations tool with action: "runs", its own
jobId, and optional limit, offset, or runId to read its job's recorded
outcomes. This includes deliveryStatus, the recorded channel and target, and
delivery.receipts with message IDs for confirmed scheduler announcements.
Older records and providers that did not return message IDs may have only the
status and target. The current run's automatic announcement happens after the
agent finishes, so its receipt becomes available to later runs.
This access follows the job identity bound to the active scheduled admission,
including a scheduler-admitted restart continuation. It does not grant another
job's history, channel history, or transcript access. A different delivery account
does not change the job's identity. An admitted paced job or one-shot session
continuation also retains next_check; a session key alone cannot restore it.
Run-history search matches summaries, task names, and execution or delivery errors. You can search the delivery error shown on a run even when its execution status is ok.
Run history shows a loading indicator while the selected history is unavailable. A failed request shows an error in the history section. When Retry is available, it reloads the failed page of history without starting the automation. Previously loaded runs for the same selection remain visible. Empty-history guidance appears only after a successful request confirms there are no runs for the current selection and filters.
After a temporary Gateway reconnect, Automations reopens the current selected job and run using fresh job data. Closing the panel or choosing another automation replaces that selection; reconnect does not replay a superseded link. Show all activity clears the linked-run selection across reconnects. Changing the Gateway identity or agent scope clears the selection.
Gateway clients can read a run’s recorded conversation using cron.history with a job id and an exact runId or runAtMs; the response contains messages, optional activity, and an opaque nextCursor. Missing or ambiguous run records remain unavailable rather than opening a different run. The selected run identifies its recorded conversation generation: isolated runs have a fresh generation, while custom sessions retain their shared conversation history across runs. Current job and session permissions apply to every page. Unavailable or inaccessible transcripts return a generic error without disclosing the selected session key.
Intentional silence (NO_REPLY), heartbeat acknowledgments, and channel reply transforms record deliverySuppressionReason without claiming delivery or triggering delivery-failure alerts. These successful non-outcomes and successful executions with explicit delivery.bestEffort: true delete one-shots normally. An empty model final is not intentional silence; exhausted recovery records a failed run rather than a synthetic successful NO_REPLY. A transport hook veto instead records a delivery error without an intentional-suppression reason. Active descendants without a final reply, stale interim output, and output emptied by TTS instead record a delivery error. If a one-shot main-session reminder has saved its reply in the conversation and delivery times out, delivery is marked unknown. Check the saved reply and the destination before retrying. Retained one-shot jobs do not automatically rerun; inspect their history and delivery outcome before retrying or removing them.
Direct Gateway event sources can use cron.run with mode: "if-enabled" to run immediately without overriding an operator-disabled or auto-disabled job. Explicit operator run-now commands continue to use force.
After a timed one-shot fails and has no retries left, fix the cause and run openclaw automations enable <jobId> to give it one fresh attempt. If the payload succeeded but required delivery failed, enabling the job runs the payload again; it does not just resend the previous output. Delivery measures lateness from when you enable the job, not from the failed attempt. The failed run stays in history. Enabling a successfully completed one-shot does not run it again. If you disable a one-shot during its scheduled run or after using Run now for an overdue run, enabling it does not replay the stopped occurrence. Use Run now for another manual run, or set a new time for a scheduled run.
Re-enabling an auto-disabled job or an exhausted stream resets its failure counters. API clients reconciling a declarationKey can do the same with explicit enabled: true; routine declarations that omit enablement preserve stopped jobs, and routine reconciliation preserves existing failure streaks.
The agent automations tool returns compact job summaries (id, name, enabled, effectiveAgentId, nextRunAt, nextRunAtMs, scheduleKind, lastRunAt, lastRunStatus) from automations(action: "list"). effectiveAgentId identifies the resolved execution owner, or is null when ownership is unresolved. Run dates are exact ISO timestamps, or null when absent; the millisecond fields remain available for programmatic callers. Time-based jobs also include their exact schedule (at, every, or cron), including disabled jobs with no next run. Event-driven schedules, payloads, and delivery definitions remain omitted; use automations(action: "get", jobId: "...") for one full job definition. Direct Gateway callers can pass compact: true to cron.list; omitting it preserves the full response with delivery previews. cron.add includes the same dry-run preview on the created job so create-time output names a resolved route or a reason delivery was rejected.
openclaw automations create is an alias for openclaw automations add. New jobs can use a positional schedule ("0 9 * * 1", "every 1h", "20m", or an ISO timestamp) followed by a positional agent prompt. Use --webhook <url> on automations add|create or automations edit to POST the finished run payload to an HTTP endpoint; webhook delivery cannot combine with chat delivery flags (--announce, --channel, --to, --thread-id, --account). On automations edit, --clear-channel, --clear-to, --clear-thread-id, and --clear-account unset those routing fields individually (each rejected alongside its matching set flag) — distinct from --no-deliver, which only disables runner fallback delivery.
The webhook URL remains subject to the strict outbound policy; configure cron.webhookSsrfPolicy for an intentional local or private receiver.
Clearing Timeout (seconds) in the Control UI and saving removes the saved override, restoring the default runtime budget. For API clients, a cron.update payload patch sets a timeout with a number, clears it with timeoutSeconds: null, and preserves the saved value when timeoutSeconds is omitted. New jobs omit the field to use the default; null is only an update instruction.
Configuration
webhookToken is sent as Authorization: Bearer <token> on automation webhook POSTs.
Webhook URLs must not include embedded username/password credentials; use
webhookToken when the receiver supports bearer authentication.
webhookSsrfPolicy applies to every outbound automation webhook and is strict
when omitted. Prefer narrow allowedHostnames entries over the broad
dangerouslyAllowPrivateNetwork opt-in.
Automation jobs, run history, and quarantined malformed jobs live in the shared SQLite state database. Use the CLI or Gateway API to change jobs; cron.store is retired.
Set cron.skipMissedJobs: true to skip recurring (cron and every) slots missed while the Gateway was offline. At startup, those jobs advance to their next future occurrence instead of catching up, avoiding stale reminders and unnecessary model calls at the cost of dropping missed work. The default is false (catch up); one-shot (at) jobs retain their normal catch-up behavior either way.
Disable automatic runs: cron.enabled: false or OPENCLAW_SKIP_CRON=1. These settings do not prevent manual runs.
Set cron.defaultTools: ["read"] to add common prerequisites when the agent's
automations tool creates or explicitly revises a nonempty payload.toolsAllow
selection. For example, ["execute_code"] becomes ["execute_code", "read"]
before creator-policy checks and approval. The setting accepts any tool names;
it does not grant unavailable tools or change filesystem, provider, or recurring
approval enforcement. Unset or [] adds nothing.
Use the request-level toolsAllowMode: "exact" beside action and job to opt
out when the supplied list is an intentional restriction. An explicit
payload.toolsAllow: [] always remains tool-less. Omitted or cleared selections
keep their existing native semantics. The mode is not stored in the job.
Saved jobs and edits that leave toolsAllow alone are unchanged; intentionally
revise a job's tool selection to adopt new defaults. CLI and direct Gateway
writes retain their explicit selections. Hosts that construct approval proposals
use the shared SDK helper before binding the proposal;
already approved shapes must be replayed unchanged.
A caller who can define a host-executed automation can make the Gateway start a process with its host privileges. That process can access credentials readable by the Gateway or alter configuration files writable by it. Direct file writes bypass Gateway API restrictions such as OPENCLAW_CONFIG_READONLY even when local terminals are disabled.
To block this execution path, start the Gateway with OPENCLAW_DISABLE_CRON_HOST_EXECUTION=1 in its launch environment. The Gateway refuses command and script payloads, condition triggers, on-exit schedules, and Gateway-hosted stream sources, including persisted and manually requested jobs. Scheduled agent turns and authorized sandbox-backed stream sources remain available. Existing blocked jobs can still be disabled or removed. Gateway configuration cannot change this control; change the launch environment and restart the Gateway to change it. The control does not govern tools used by agent turns or provide filesystem isolation.
Retry behavior
One-shot retry: transient errors (rate limit, overload, network, timeout, server error) retry up to three times after 30 seconds, 60 seconds, and 5 minutes. A later provider rate-limit reset delays the retry until that time, including across Gateway restarts, without holding the failure notice for the extended wait. Pausing a one-shot also pauses its pending retry. Resuming the same schedule restores the retry deadline, even if it passed while paused. Watchdog stalls and caller aborts use the same bounded policy; rate-limited model fallback exhaustion retains its provider classification. Explicit user cancellation, revoked authentication, invalid configuration, and missing targets do not retry. After a permanent failure or the last retry, the job ends and its owner is notified. Gateway restart/drain interruptions retain the restart recovery policy.
Recurring retry: consecutive execution errors back off on an extended schedule (30s, 60s, 5m, 15m, 60m). Backoff resets after the next successful run. When a provider gives a rate-limit reset time, restarting the Gateway does not bring the scheduled retry forward, and the failure alert shows the next run time. A successful forced run, re-enabling the job, or a schedule edit returns the job to its normal schedule.
Maintenance
cron.sessionRetention (default 24h, false or "0h" disables) prunes isolated run-session entries. Terminal run history is retained for 7 days (lost rows for 24 hours), with the newest 2000 rows per job and history class enforced as an additional ceiling.
Per-agent run-session retention skips agent databases still undergoing startup preparation while maintaining healthy agents. Completed preparation wakes retention for the newly available database. These sweeps keep the Gateway's maintenance context rather than borrowing the publisher's temporary startup admission. Retention continues even when scheduled execution is disabled.
The seven-day session registry sweep checks descendants only for expired, unprotected run rows. It retains an exact-run parent while it has a non-archived descendant, including through archived intermediate sessions or in another agent's store. If a non-deleted agent's store is unavailable or held for recovery, the registry sweep defers pruning across healthy stores too and retries every minute: the unavailable store may still contain a live descendant. Once those stores are available and no live descendants remain, the expired parent can be pruned. This preserves the parent communication policy for sessions_send; it does not restore parent rows deleted before this fix.
After each registry sweep, the Gateway waits until the next candidate expiry or a committed cron-session or store-topology change. Empty, unchanged registries do not need periodic reads. Protected expired sessions and failed sweeps retry every minute; run-history recovery keeps its existing minute cadence.
Per-agent session stores also retain their next cron-run expiry, so empty or unexpired stores do not require reads on every maintenance tick. Committed cron-run changes refresh that deadline; busy sessions and failed session-store sweeps retry after five minutes.
Session retention skips agents with pending or completed deletion while continuing maintenance for healthy agents. Pending deletion cleanup remains owned by the agent deletion operation.
Legacy store migration
openclaw doctor --fix imports supported jobs-quarantine.json sidecars into SQLite and archives the originals with a .migrated suffix. Retired jobs.json, jobs-state.json, and runs/*.jsonl inputs remain unchanged: install OpenClaw 2026.9.7, run its Doctor, then upgrade to the latest version. See the retention policy. Malformed SQLite job rows remain recoverable in quarantine while valid jobs keep running.