2026-01-15 06:12:54 +00:00
---
2026-01-30 03:15:10 +01:00
summary: "CLI reference for `openclaw agent` (send one agent turn via the Gateway)"
2026-01-15 06:12:54 +00:00
read_when:
- You want to run one agent turn from scripts (optionally deliver reply)
2026-01-31 16:04:03 -05:00
title: "agent"
2026-01-15 06:12:54 +00:00
---
2026-01-30 03:15:10 +01:00
# `openclaw agent`
2026-01-15 06:12:54 +00:00
Run an agent turn via the Gateway (use `--local` for embedded).
2026-01-18 22:49:55 +00:00
Use `--agent <id>` to target a configured agent directly.
2026-01-15 06:12:54 +00:00
2026-04-04 08:42:43 +01:00
Pass at least one session selector:
- `--to <dest>`
- `--session-id <id>`
- `--agent <id>`
2026-01-15 06:12:54 +00:00
Related:
2026-01-31 21:13:13 +09:00
2026-01-15 06:12:54 +00:00
- Agent send tool: [Agent send ](/tools/agent-send )
2026-04-04 08:42:43 +01:00
## Options
- `-m, --message <text>` : required message body
- `-t, --to <dest>` : recipient used to derive the session key
- `--session-id <id>` : explicit session id
- `--agent <id>` : agent id; overrides routing bindings
- `--thinking <off|minimal|low|medium|high|xhigh>` : agent thinking level
- `--verbose <on|off>` : persist verbose level for the session
- `--channel <channel>` : delivery channel; omit to use the main session channel
- `--reply-to <target>` : delivery target override
- `--reply-channel <channel>` : delivery channel override
- `--reply-account <id>` : delivery account override
2026-04-04 09:04:11 +01:00
- `--local` : run the embedded agent directly (after plugin registry preload)
2026-04-04 08:42:43 +01:00
- `--deliver` : send the reply back to the selected channel/target
- `--timeout <seconds>` : override agent timeout (default 600 or config value)
- `--json` : output JSON
2026-01-15 06:12:54 +00:00
## Examples
``` bash
2026-01-30 03:15:10 +01:00
openclaw agent --to +15555550123 --message "status update" --deliver
openclaw agent --agent ops --message "Summarize logs"
openclaw agent --session-id 1234 --message "Summarize inbox" --thinking medium
2026-04-04 08:42:43 +01:00
openclaw agent --to +15555550123 --message "Trace logs" --verbose on --json
2026-01-30 03:15:10 +01:00
openclaw agent --agent ops --message "Generate report" --deliver --reply-channel slack --reply-to "#reports"
2026-04-04 08:42:43 +01:00
openclaw agent --agent ops --message "Run locally" --local
2026-01-15 06:12:54 +00:00
```
2026-03-07 11:28:39 -06:00
## Notes
2026-04-04 08:42:43 +01:00
- Gateway mode falls back to the embedded agent when the Gateway request fails. Use `--local` to force embedded execution up front.
2026-04-04 09:04:11 +01:00
- `--local` still preloads the plugin registry first, so plugin-provided providers, tools, and channels stay available during embedded runs.
2026-04-04 08:42:43 +01:00
- `--channel` , `--reply-channel` , and `--reply-account` affect reply delivery, not session routing.
2026-03-12 02:22:52 -05:00
- When this command triggers `models.json` regeneration, SecretRef-managed provider credentials are persisted as non-secret markers (for example env var names, `secretref-env:ENV_VAR_NAME` , or `secretref-managed` ), not resolved secret plaintext.
- Marker writes are source-authoritative: OpenClaw persists markers from the active source config snapshot, not from resolved runtime secret values.