Skip to content

openclaw agent (直接智能体运行)

openclaw agent 无需接收聊天消息即可运行单次智能体回合。 默认情况下它会通过 Gateway 网关运行;添加 --local 可强制使用当前机器上的嵌入式运行时。

行为

  • 必需: --message <text>
  • 会话选择:
    • --to <dest> 派生会话密钥(群组/渠道目标保持隔离;私信折叠为 main),或者
    • --session-id <id> 通过 id 重用现有会话,或者
    • --agent <id> 直接定位到配置的智能体(使用该智能体的 main 会话密钥)
  • 运行与正常入站回复相同的嵌入式智能体运行时。
  • 思考/详细标志会持久化到会话存储中。
  • 输出:
    • 默认: 打印回复文本(加上 MEDIA:<url> 行)
    • --json: 打印结构化负载 + 元数据
  • 可选使用 --deliver + --channel 将消息投递回渠道(目标格式与 openclaw message --target 匹配)。
  • 使用 --reply-channel/--reply-to/--reply-account 覆盖投递设置而不改变会话。

如果 Gateway 网关不可达,CLI 将回退到嵌入式本地运行。

示例

bash
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 密钥)
  • --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