Agent coordination
エージェント送信
openclaw agent は、受信チャットメッセージを必要とせずに、コマンドラインから単一のエージェントターンを実行します。スクリプト化されたワークフロー、テスト、プログラムによる配信に使用します。
クイックスタート
単純なエージェントターンを実行する
openclaw agent --message "What is the weather today?"
これにより、メッセージが Gateway 経由で送信され、返信が出力されます。
特定のエージェントまたはセッションを対象にする
# Target a specific agent
openclaw agent --agent ops --message "Summarize logs"
# Target a phone number (derives session key)
openclaw agent --to +15555550123 --message "Status update"
# Reuse an existing session
openclaw agent --session-id abc123 --message "Continue the task"
返信をチャンネルに配信する
# Deliver to WhatsApp (default channel)
openclaw agent --to +15555550123 --message "Report ready" --deliver
# Deliver to Slack
openclaw agent --agent ops --message "Generate report" \
--deliver --reply-channel slack --reply-to "#reports"
フラグ
| フラグ | 説明 |
|---|---|
--message \<text\> |
送信するメッセージ(必須) |
--to \<dest\> |
対象(電話、チャット ID)からセッションキーを導出します |
--agent \<id\> |
設定済みエージェントを対象にします(その main セッションを使用) |
--session-id \<id\> |
ID で既存のセッションを再利用します |
--local |
ローカルの組み込みランタイムを強制します(Gateway をスキップ) |
--deliver |
返信をチャットチャンネルに送信します |
--channel \<name\> |
配信チャンネル(whatsapp、telegram、discord、slack など) |
--reply-to \<target\> |
配信先の上書き |
--reply-channel \<name\> |
配信チャンネルの上書き |
--reply-account \<id\> |
配信アカウント ID の上書き |
--thinking \<level\> |
選択したモデルプロファイルの思考レベルを設定します |
--verbose \<on|full|off\> |
詳細出力レベルを設定します |
--timeout \<seconds\> |
エージェントのタイムアウトを上書きします |
--json |
構造化 JSON を出力します |
動作
- デフォルトでは、CLI は Gateway 経由で動作します。現在のマシン上の組み込みランタイムを強制するには
--localを追加します。 - Gateway に到達できない場合、CLI はローカルの組み込み実行にフォールバックします。
- セッション選択:
--toはセッションキーを導出します(グループ/チャンネル対象は分離を保持し、直接チャットはmainに集約されます)。 - thinking と verbose のフラグはセッションストアに保持されます。
- 出力: デフォルトはプレーンテキスト、構造化ペイロード + メタデータには
--jsonを使用します。
例
# Simple turn with JSON output
openclaw agent --to +15555550123 --message "Trace logs" --verbose on --json
# Turn with thinking level
openclaw agent --session-id 1234 --message "Summarize inbox" --thinking medium
# Deliver to a different channel than the session
openclaw agent --agent ops --message "Alert" --deliver --reply-channel telegram --reply-to "@admin"