openclaw agent(直接代理執行)
openclaw agent 可在不需要入站聊天訊息的情況下執行單次代理回合。預設會透過 Gateway 處理;加上 --local 則強制使用當前機器上的內嵌執行環境。
行為
- 必填:
--message <text> - 工作階段選擇:
--to <dest>衍生工作階段 key(群組 / 頻道目標會保持隔離;私訊則合併至main),或--session-id <id>透過 id 重用既有的工作階段,或--agent <id>直接指定已設定的代理(使用該代理的main工作階段 key)
- 與一般入站回覆使用相同的內嵌代理執行環境。
- thinking/verbose 旗標會持久化到工作階段儲存區。
- 輸出:
- 預設:印出回覆文字(外加
MEDIA:<url>行) --json:印出結構化的 payload + 元資料
- 預設:印出回覆文字(外加
- 可選擇透過
--deliver+--channel將結果投遞回某個頻道(目標格式與openclaw message --target相同)。 - 使用
--reply-channel/--reply-to/--reply-account可覆寫投遞目標而不影響工作階段。
如果 Gateway 無法連線,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