Agent coordination
Agent send
openclaw agent runs a single agent turn from the command line without needing
an inbound chat message. Use it for scripted workflows, testing, and
programmatic delivery.
Quick start
Run a simple agent turn
openclaw agent --agent main --message "What is the weather today?"This sends the message through the Gateway and prints the reply.
Target a specific agent or session
# Target a specific agentopenclaw agent --agent ops --message "Summarize logs" # Target a phone number (derives session key)openclaw agent --to +15555550123 --message "Status update" # Reuse an existing sessionopenclaw agent --session-id abc123 --message "Continue the task" # Target an exact session keyopenclaw agent --session-key agent:ops:incident-42 --message "Summarize status"Deliver the reply to a channel
# Deliver to WhatsApp (default channel)openclaw agent --to +15555550123 --message "Report ready" --deliver # Deliver to Slackopenclaw agent --agent ops --message "Generate report" \ --deliver --reply-channel slack --reply-to "#reports"Flags
| Flag | Description |
|---|---|
--message \<text\> |
Message to send (required) |
--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 |
--local |
Force local embedded runtime (skip Gateway) |
--deliver |
Send the reply to a chat channel |
--channel \<name\> |
Delivery channel (whatsapp, telegram, discord, slack, 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\> |
Set verbose level |
--timeout \<seconds\> |
Override agent timeout |
--json |
Output structured JSON |
Behavior
- By default, the CLI goes through the Gateway. Add
--localto force the embedded runtime on the current machine. - If the Gateway is unreachable, the CLI falls back to the local embedded run.
- 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; in that case, embedded fallback and store ownership use the configured default agent.- 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
# Simple turn with JSON outputopenclaw agent --to +15555550123 --message "Trace logs" --verbose on --json # Turn with thinking levelopenclaw agent --session-id 1234 --message "Summarize inbox" --thinking medium # Exact session keyopenclaw agent --session-key agent:ops:incident-42 --message "Summarize status" # Legacy key scoped to an agentopenclaw agent --agent ops --session-key incident-42 --message "Summarize status" # Deliver to a different channel than the sessionopenclaw agent --agent ops --message "Alert" --deliver --reply-channel telegram --reply-to "@admin"Related
Was this useful?