openclaw agent runs a single agent turn from the command line without an
inbound chat message. Use it for scripted workflows, testing, and
programmatic delivery. Full flag and behavior reference:
Agent CLI reference.
Quick start
Flags
| Flag | Description |
|---|---|
--message <text> | Inline message to send |
--message-file <path> | Read the message from a valid UTF-8 file |
--to <dest> | Derive session key from a target (phone, chat id) |
--session-key <key> | Use an explicit session key |
--agent <id> | Target a configured agent (uses its main session) |
--session-id <id> | Reuse an existing session by id |
--model <id> | Model override for this run (provider/model or model id) |
--local | Force local embedded runtime (skip Gateway) |
--deliver | Send the reply to a chat channel |
--channel <name> | Delivery channel (discord, slack, telegram, whatsapp, etc.) |
--reply-to <target> | Delivery target override |
--reply-channel <name> | Delivery channel override |
--reply-account <id> | Delivery account id override |
--thinking <level> | Set thinking level for the selected model profile |
--verbose <on|full|off> | Persist verbose level for the session (full also logs tool output) |
--timeout <seconds> | Override agent timeout (default 600, or config value) |
--json | Output structured JSON |
Behavior
- By default, the CLI goes through the Gateway. Add
--localto force the embedded runtime on the current machine. - Pass exactly one of
--messageor--message-file. File messages preserve multiline content after removing an optional UTF-8 BOM. - If the Gateway request fails, the CLI falls back to the local embedded run; a Gateway timeout falls back with a fresh session instead of racing the original transcript.
- Session selection:
--toderives the session key (group/channel targets preserve isolation; direct chats collapse tomain). --session-keyselects an explicit key. Agent-prefixed keys must useagent:<agent-id>:<session-key>, and--agentmust match that agent id when both are supplied. Bare non-sentinel keys are scoped to--agentwhen supplied; for example,--agent ops --session-key incident-42routes toagent:ops:incident-42. Without--agent, bare non-sentinel keys are scoped to the configured default agent. Literalglobalandunknownremain unscoped only when no--agentis supplied; the embedded fallback path resolves those sentinel sessions to the configured default agent.--channel,--reply-channel, and--reply-accountaffect reply delivery, not session routing.- Thinking and verbose flags persist into the session store.
- Output: plain text by default, or
--jsonfor structured payload + metadata. - With
--json --deliver, the JSON includes delivery status for sent, suppressed, partial, and failed sends. See JSON delivery status.
Examples
Related
Agent CLI reference
Full
openclaw agent flag and option reference.Sub-agents
Background sub-agent spawning.
Sessions
How session keys work and how
--to, --agent, and --session-id resolve them.Slash commands
Native command catalog used inside agent sessions.