コマンド概要
openclaw agents コマンドは複数のAIエージェント(Agent)を管理するために使用します。各エージェントには異なるペルソナ、モデル、スキル、動作設定を持たせることができ、マルチロールAIが必要なシーンに適しています。
エージェント一覧の表示
openclaw agents list
出力:
Agents:
default gpt-4o-mini Active General assistant
code-helper gpt-4o Active Programming assistant
translator gpt-4o-mini Active Translation specialist
customer-svc claude-sonnet Inactive Customer service bot
新規エージェントの作成
openclaw agents create assistant-ja
インタラクティブ作成:
Creating new agent: assistant-ja
Display name: 日本語アシスタント
Description: 日本語の会話に特化したAIアシスタント
Model [gpt-4o-mini]: qwen-72b
System prompt: あなたはプロフェッショナルな日本語AIアシスタントです。日本語での執筆、翻訳、知識Q&Aを得意としています。常に日本語で回答してください。
Agent 'assistant-ja' created successfully.
非インタラクティブ作成:
openclaw agents create code-expert \
--display-name "コードエキスパート" \
--model gpt-4o \
--system "あなたはシニアフルスタックエンジニアです。コードレビュー、アーキテクチャ設計、技術ドキュメント作成を得意としています。" \
--tools code_exec,web_search \
--temperature 0.3
エージェント設定の詳細
openclaw agents show code-expert
出力:
Agent: code-expert
Display Name: コードエキスパート
Model: gpt-4o
Temperature: 0.3
Max Tokens: 4096
System Prompt: あなたはシニアフルスタックエンジニアです...
Tools: code_exec, web_search
Channels: discord-dev
Status: Active
Created: 2026-03-14
Messages: 1,520
エージェント設定の変更
# モデルの変更
openclaw agents update code-expert --model gpt-4o-mini
# システムプロンプトの変更
openclaw agents update code-expert --system "新しいシステムプロンプト"
# Temperatureの変更
openclaw agents update code-expert --temperature 0.5
# ツールの追加
openclaw agents update code-expert --add-tool image_gen
エージェントのチャンネル割り当て
# エージェントをチャンネルに割り当て
openclaw agents assign code-expert --channel discord-dev
openclaw agents assign assistant-ja --channel wechat-main
# エージェントのチャンネル割り当てを確認
openclaw agents channels code-expert
1つのチャンネルに紐付けられるエージェントは1つだけですが、1つのエージェントは複数のチャンネルを担当できます。
エージェント間ルーティング
メッセージルーティングルールを設定して、内容に応じて自動的に異なるエージェントに振り分けます。
{
"routing": {
"enabled": true,
"rules": [
{
"match": "コード|プログラミング|bug|関数",
"agent": "code-expert"
},
{
"match": "翻訳|translate",
"agent": "translator"
},
{
"match": ".*",
"agent": "default"
}
]
}
}
エージェントの有効化/無効化
# エージェントを無効化(メッセージ処理を停止)
openclaw agents disable customer-svc
# エージェントを有効化
openclaw agents enable customer-svc
エージェントの削除
openclaw agents delete old-agent
注意:エージェントを削除しても、過去の会話履歴は削除されません。
エージェント統計
openclaw agents stats code-expert
Agent Stats: code-expert (last 7 days)
Messages processed: 342
Avg response time: 2.1s
Token usage: 125,000
Estimated cost: $1.25
Active sessions: 5
Error rate: 0.3%
一括管理
# すべてのエージェント設定をエクスポート
openclaw agents export agents-backup.json
# エージェント設定をインポート
openclaw agents import agents-backup.json
# モデルの一括更新
openclaw agents update-all --model gpt-4o-mini
設定ファイルでのエージェント定義
{
"agents": {
"code-expert": {
"displayName": "コードエキスパート",
"model": "gpt-4o",
"systemPrompt": "あなたはシニアエンジニアです...",
"temperature": 0.3,
"tools": ["code_exec", "web_search"],
"maxTokens": 4096
},
"translator": {
"displayName": "翻訳者",
"model": "gpt-4o-mini",
"systemPrompt": "あなたはプロの翻訳者です...",
"temperature": 0.3,
"maxTokens": 2048
}
}
}
まとめ
openclaw agents を使えば、同一の OpenClaw インスタンス内で異なる能力とペルソナを持つ複数のAIエージェントを実行できます。適切なエージェント分業とルーティング設定により、異なるユーザー層にカスタマイズされたAIサービスを提供できます。