A2Aエージェントコマンド
Agent-to-Agent (A2A) エージェントとタスクの管理
🚧 実験的機能
A2A機能は実験的な機能です。APIが変更される可能性があります。
agent - A2Aエージェント管理
Agent-to-Agent通信をサポートするエージェントを管理します。
A2Aとは?
Agent-to-Agent (A2A) は、複数のAIエージェント間での直接通信と協調動作を可能にするプロトコルです。ProofScanはA2A通信を監視し、記録することができます。
サブコマンド
agent ls
登録されているA2Aエージェントの一覧を表示します。
pfscan agent ls
pfscan agent ls --json
出力例:
A2A Agents:
researcher ✓ active Tasks: 3
summarizer ✓ active Tasks: 1
coordinator ✗ idle Tasks: 0
agent add
新しいA2Aエージェントを登録します。
# 基本的な追加
pfscan agent add --id researcher --connector mcp-research
# カスタム設定を指定
pfscan agent add --id researcher \
--connector mcp-research \
--role "research" \
--capabilities "search,analyze"
agent show
エージェントの詳細情報を表示します。
pfscan agent show --id researcher
pfscan agent show --id researcher --json
agent scan
A2Aエージェントの通信をスキャンします。
# 特定のエージェントをスキャン
pfscan agent scan --id researcher
# 全エージェントをスキャン
pfscan agent scan --all
# タイムアウト指定
pfscan agent scan --id researcher --timeout 60
agent remove
A2Aエージェントを削除します。
pfscan agent remove --id researcher
エージェントの役割
| 役割 | 説明 | 用途 |
|---|---|---|
coordinator |
コーディネーター | タスクの分配と調整 |
researcher |
リサーチャー | 情報収集と分析 |
summarizer |
要約者 | 情報の要約と整理 |
executor |
実行者 | アクションの実行 |
validator |
検証者 | 結果の検証と確認 |
task - A2Aタスク管理
A2Aエージェント間のタスクを管理します。
サブコマンド
task ls
タスクの一覧を表示します。
# 全タスク
pfscan task ls
# エージェントでフィルタ
pfscan task ls --agent researcher
# ステータスでフィルタ
pfscan task ls --status pending
pfscan task ls --status running
pfscan task ls --status completed
# JSON形式
pfscan task ls --json
出力例:
Tasks:
task-001 researcher ✓ completed "Search for MCP documentation"
task-002 summarizer ⏳ running "Summarize search results"
task-003 coordinator ⏸ pending "Distribute next batch"
task show
タスクの詳細を表示します。
pfscan task show --id task-001
pfscan task show --id task-001 --json
出力例:
Task: task-001
Agent: researcher
Status: completed
Created: 2026-01-04T12:00:00Z
Started: 2026-01-04T12:00:05Z
Completed: 2026-01-04T12:01:23Z
Duration: 78s
Description:
Search for MCP documentation
Input:
query: "Model Context Protocol specification"
sources: ["official", "github"]
Output:
results: 15 documents found
summary: "MCP is a protocol for..."
Dependencies:
None
Dependents:
task-002 (summarizer)
task cancel
実行中のタスクをキャンセルします。
pfscan task cancel --id task-002
タスクステータス
| ステータス | 説明 | 記号 |
|---|---|---|
pending |
実行待ち | ⏸ |
running |
実行中 | ⏳ |
completed |
完了 | ✓ |
failed |
失敗 | ✗ |
cancelled |
キャンセル | ⊗ |
A2Aワークフロー例
基本的なマルチエージェント協調
# 1. エージェントを登録
pfscan agent add --id researcher --connector mcp-research
pfscan agent add --id summarizer --connector mcp-summarize
pfscan agent add --id coordinator --connector mcp-coord
# 2. エージェント一覧を確認
pfscan agent ls
# 3. 通信をスキャン(別ターミナル)
pfscan agent scan --all
# 4. タスクを監視
pfscan task ls --status running
# 5. 結果を確認
pfscan task show --id task-001
リサーチ→要約→検証のパイプライン
# リサーチエージェントがタスク実行
# → task-001: "Search for documentation"
# 要約エージェントが依存タスク実行
# → task-002: "Summarize results" (depends on task-001)
# 検証エージェントが最終確認
# → task-003: "Validate summary" (depends on task-002)
# プロセス全体を監視
pfscan task ls
pfscan view --connector coordinator
タスクのデバッグ
# 失敗したタスクを特定
pfscan task ls --status failed
# タスクの詳細を確認
pfscan task show --id task-005
# 関連するRPC通信を確認
pfscan rpc list --session
# エラーイベントを確認
pfscan view --errors --connector researcher
A2A通信の監視
リアルタイム監視
# ターミナル1: エージェントスキャン
pfscan agent scan --all
# ターミナル2: タスク監視
watch -n 2 'pfscan task ls'
# ターミナル3: イベントモニタリング
pfscan view -f --connector coordinator
通信パターンの分析
# エージェント間の通信頻度
pfscan analyze --connector coordinator
# タスク依存関係の可視化
pfscan tree coordinator
# パフォーマンス分析
pfscan view --connector researcher --limit 100 | grep "lat="
POPL生成
A2A通信の監査証跡を作成:
# セッションからPOPLエントリを作成
pfscan popl session --session \
--title "A2A Multi-Agent Research Pipeline"
# 公開安全な監査証跡が生成されます
pfscan popl list
ベストプラクティス
エージェント設計
- 単一責任: 各エージェントは1つの明確な役割を持つ
- 疎結合: エージェント間の依存関係を最小限に
- 冪等性: タスクは再実行可能に設計
- エラーハンドリング: 失敗時の代替戦略を用意
タスク管理
- タイムアウト設定: 長時間実行タスクにはタイムアウトを
- 進捗報告: 定期的にステータスを更新
- 依存関係管理: タスクの依存関係を明示的に
- ログ記録: 重要な決定とエラーをログに残す
監視とデバッグ
- リアルタイム監視: 本番環境では常時監視
- POPL記録: 重要なワークフローはPOPL化
- パフォーマンス追跡: レイテンシとスループットを監視
- 異常検知: エラー率の急上昇に注意
トラブルシューティング
Q. エージェントが応答しない
A. 以下を確認:
- エージェントのステータス:
pfscan agent show --id <id> - コネクタが有効:
pfscan connectors list - ネットワーク接続
- エージェントログ:
pfscan view --connector <connector> --errors
Q. タスクが pending のまま動かない
A. 依存関係を確認:
# タスク詳細で依存関係確認
pfscan task show --id <task-id>
# 依存するタスクのステータス確認
pfscan task ls --status running
pfscan task ls --status failed
Q. A2A通信が記録されない
A. スキャンが実行中か確認:
# エージェントスキャンを開始
pfscan agent scan --all
# ステータス確認
pfscan status