Agent Send

openclaw agent (direct agent runs)

openclaw agent 运行单个 agent turn 而不需要 inbound chat message。 默认情况下它通过 Gateway运行;添加 --local 强制在当前机器上使用 embedded runtime。

Behavior

  • 必需:--message <text>
  • Session selection:
    • --to <dest> 推导 session key(group/channel targets 保持 isolation;direct chats collapse 到 main),
    • --session-id <id> 通过 id 重用现有 session,
    • --agent <id> 直接 targeting 配置好的 agent(使用该 agent 的 main session key)
  • 运行与正常 inbound replies 相同的 embedded agent runtime。
  • Thinking/verbose flags 持久化到 session store。
  • Output:
    • default:打印 reply text(加上 MEDIA:<url> lines)
    • --json:打印 structured payload + metadata
  • 可选 delivery 回 channel 使用 --deliver + --channel(target formats 匹配 openclaw message --target)。
  • 使用 --reply-channel/--reply-to/--reply-account 来 override delivery 而不改变 session。

如果 Gateway 不可达,CLI 回退到 embedded local run。

Examples

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"

Flags

  • --local:本地运行(需要在 shell 中配置 model provider API keys)
  • --deliver:发送 reply 到选择的 channel
  • --channel:delivery channel(whatsapp|telegram|discord|googlechat|slack|signal|imessage,默认:whatsapp
  • --reply-to:delivery target override
  • --reply-channel:delivery channel override
  • --reply-account:delivery account id override
  • --thinking <off|minimal|low|medium|high|xhigh>:持久化 thinking level(仅 GPT-5.2 + Codex models)
  • --verbose <on|full|off>:持久化 verbose level
  • --timeout <seconds>:override agent timeout
  • --json:输出 structured JSON