Agent coordination
エージェント送信
openclaw agent は、受信チャットメッセージを必要とせず、コマンドラインから単一のエージェントターンを実行します。スクリプト化されたワークフロー、テスト、プログラムによる配信に使用します。
クイックスタート
単純なエージェントターンを実行する
openclaw agent --agent main --message "What is the weather today?"これはメッセージを Gateway 経由で送信し、返信を出力します。
ファイルから複数行プロンプトを送信する
openclaw agent --agent ops --message-file ./task.mdこれは有効な UTF-8 ファイルをエージェントメッセージ本文として読み取ります。
特定のエージェントまたはセッションを対象にする
# Target a specific agentopenclaw agent --agent ops --message "Summarize logs" # Target a phone number (derives session key)openclaw agent --to +15555550123 --message "Status update" # Reuse an existing sessionopenclaw agent --session-id abc123 --message "Continue the task" # Target an exact session keyopenclaw agent --session-key agent:ops:incident-42 --message "Summarize status"返信をチャネルに配信する
# Deliver to WhatsApp (default channel)openclaw agent --to +15555550123 --message "Report ready" --deliver # Deliver to Slackopenclaw agent --agent ops --message "Generate report" \ --deliver --reply-channel slack --reply-to "#reports"フラグ
| フラグ | 説明 |
|---|---|
--message \<text\> |
送信するインラインメッセージ |
--message-file \<path\> |
有効な UTF-8 ファイルからメッセージを読み取る |
--to \<dest\> |
ターゲット(電話、チャット ID)からセッションキーを導出する |
--session-key \<key\> |
明示的なセッションキーを使用する |
--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\> |
選択したモデルプロファイルの thinking レベルを設定する |
--verbose \<on|full|off\> |
verbose レベルを設定する |
--timeout \<seconds\> |
エージェントのタイムアウトを上書きする |
--json |
構造化 JSON を出力する |
動作
- デフォルトでは、CLI は Gateway 経由で動作します。現在のマシン上の埋め込みランタイムを強制するには
--localを追加します。 --messageまたは--message-fileのどちらか 1 つだけを渡します。ファイルメッセージは、任意の UTF-8 BOM を削除した後、複数行の内容を保持します。- Gateway に到達できない場合、CLI はローカル埋め込み実行にフォールバックします。
- セッション選択:
--toはセッションキーを導出します(グループ/チャネルターゲットは分離を保持し、直接チャットはmainに集約されます)。 --session-keyは明示的なキーを選択します。エージェント接頭辞付きキーはagent:<agent-id>:<session-key>を使用する必要があり、両方が指定された場合は--agentがそのエージェント ID と一致している必要があります。裸の非センチネルキーは、指定されている場合--agentにスコープされます。たとえば、--agent ops --session-key incident-42はagent:ops:incident-42にルーティングされます。--agentがない場合、裸の非センチネルキーは設定済みのデフォルトエージェントにスコープされます。リテラルのglobalとunknownは、--agentが指定されていない場合にのみスコープなしのままです。その場合、埋め込みフォールバックとストア所有権は設定済みのデフォルトエージェントを使用します。- thinking と verbose フラグはセッションストアに永続化されます。
- 出力: デフォルトではプレーンテキスト、または構造化ペイロードとメタデータには
--jsonを使用します。 --json --deliverを指定すると、JSON には送信済み、抑制済み、部分的、失敗の送信に対する配信ステータスが含まれます。JSON 配信ステータスを参照してください。
例
# Simple turn with JSON outputopenclaw agent --to +15555550123 --message "Trace logs" --verbose on --json # Turn with thinking levelopenclaw agent --session-id 1234 --message "Summarize inbox" --thinking medium # Multiline prompt from a fileopenclaw agent --agent ops --message-file ./task.md # Exact session keyopenclaw agent --session-key agent:ops:incident-42 --message "Summarize status" # Legacy key scoped to an agentopenclaw agent --agent ops --session-key incident-42 --message "Summarize status" # Deliver to a different channel than the sessionopenclaw agent --agent ops --message "Alert" --deliver --reply-channel telegram --reply-to "@admin"関連
Was this useful?