Files
openclaw/docs/tools/agent-send.md

54 lines
2.3 KiB
Markdown
Raw Normal View History

---
2026-01-30 03:15:10 +01:00
summary: "Direct `openclaw agent` CLI runs (with optional delivery)"
read_when:
- Adding or modifying the agent CLI entrypoint
title: "Agent Send"
---
2026-01-31 21:13:13 +09:00
2026-01-30 03:15:10 +01:00
# `openclaw agent` (direct agent runs)
2026-01-30 03:15:10 +01:00
`openclaw agent` runs a single agent turn without needing an inbound chat message.
2026-01-08 23:06:56 +01:00
By default it goes **through the Gateway**; add `--local` to force the embedded
runtime on the current machine.
## Behavior
2026-01-08 23:06:56 +01:00
- Required: `--message <text>`
- Session selection:
- `--to <dest>` derives the session key (group/channel targets preserve isolation; direct chats collapse to `main`), **or**
- `--session-id <id>` reuses an existing session by id, **or**
- `--agent <id>` targets a configured agent directly (uses that agent's `main` session key)
2026-01-08 23:06:56 +01:00
- Runs the same embedded agent runtime as normal inbound replies.
- Thinking/verbose flags persist into the session store.
- Output:
2026-01-08 23:06:56 +01:00
- default: prints reply text (plus `MEDIA:<url>` lines)
- `--json`: prints structured payload + metadata
2026-01-30 03:15:10 +01:00
- Optional delivery back to a channel with `--deliver` + `--channel` (target formats match `openclaw message --target`).
- Use `--reply-channel`/`--reply-to`/`--reply-account` to override delivery without changing the session.
2026-01-08 23:06:56 +01:00
If the Gateway is unreachable, the CLI **falls back** to the embedded local run.
## Examples
```bash
2026-01-30 03:15:10 +01:00
openclaw agent --to +15555550123 --message "status update"
openclaw agent --agent ops --message "Summarize logs"
openclaw agent --session-id 1234 --message "Summarize inbox" --thinking medium
openclaw agent --to +15555550123 --message "Trace logs" --verbose on --json
openclaw agent --to +15555550123 --message "Summon reply" --deliver
openclaw agent --agent ops --message "Generate report" --deliver --reply-channel slack --reply-to "#reports"
2026-01-08 23:06:56 +01:00
```
## Flags
2026-01-13 06:51:20 +00:00
- `--local`: run locally (requires model provider API keys in your shell)
- `--deliver`: send the reply to the chosen channel
2026-01-23 16:45:37 -06:00
- `--channel`: delivery channel (`whatsapp|telegram|discord|googlechat|slack|signal|imessage`, default: `whatsapp`)
- `--reply-to`: delivery target override
- `--reply-channel`: delivery channel override
- `--reply-account`: delivery account id override
2026-01-07 17:17:38 -08:00
- `--thinking <off|minimal|low|medium|high|xhigh>`: persist thinking level (GPT-5.2 + Codex models only)
2026-01-17 05:33:27 +00:00
- `--verbose <on|full|off>`: persist verbose level
2026-01-08 23:06:56 +01:00
- `--timeout <seconds>`: override agent timeout
- `--json`: output structured JSON