openclaw agent(直接代理运行)
openclaw agent 无需收到聊天消息就能运行一个单轮代理。默认通过网关执行;加 --local 可强制在当前机器上使用内嵌运行时。
行为
- 必填:
--message <text> - 会话选择:
--to <dest>根据目标推导会话 key(群组/频道目标保持隔离;私聊合并到main),或--session-id <id>复用已有的会话 ID,或--agent <id>直接指定一个已配置的代理(使用该代理的main会话 key)
- 运行的是和正常入站回复相同的内嵌代理运行时。
- 思考/详细模式标志会持久保存到会话存储中。
- 输出:
- 默认:打印回复文本(加上
MEDIA:<url>行) --json:打印结构化负载 + 元数据
- 默认:打印回复文本(加上
- 可选通过
--deliver+--channel将回复投递回频道(目标格式和openclaw message --target一致)。 - 用
--reply-channel/--reply-to/--reply-account可以覆盖投递目标而不改变会话。
如果网关不可达,CLI 会回退到内嵌本地运行。
示例
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"
参数
--local:本地运行(需要在 shell 中配置模型提供者 API key)--deliver:将回复发送到选定的频道--channel:投递频道(whatsapp|telegram|discord|googlechat|slack|signal|imessage,默认:whatsapp)--reply-to:投递目标覆盖--reply-channel:投递频道覆盖--reply-account:投递账号 ID 覆盖--thinking <off|minimal|low|medium|high|xhigh>:持久化思考级别(仅 GPT-5.2 + Codex 模型)--verbose <on|full|off>:持久化详细级别--timeout <seconds>:覆盖代理超时--json:输出结构化 JSON