Swarm Orchestration について
Swarm Orchestration は、agentic-flow で複数エージェントの群れを調整するスキルです。複数のトポロジーや実行方式、共有メモリ、障害対策を備えています。
主な機能
- 01メッシュ、階層型、適応型トポロジー
- 02並列実行と依存関係パイプライン
- 03タスクの自動配分と負荷分散
- 04エージェント間の共有メモリ
- 05再試行とタスクの再割り当て
- 06群れのメトリクスとフック
活用シーン
- 01コーディング、テスト、レビューのエージェントを連携
- 02設計、実装、テスト、レビューを順に実行
- 03適応型トポロジーで変化する作業負荷を調整
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ ruvnet/ ruview --skill swarm-orchestrationインストール後、Claude Code で/swarm-orchestrationを入力して読み込まれたか確認します。
詳細
スウォームオーケストレーション
このスキルでできること
agentic-flow の高度な連携システムを使用して、複数のエージェントで構成されるスウォームをオーケストレーションします。メッシュ型、階層型、適応型のトポロジーに対応し、タスクの自動分配、負荷分散、フォールトトレランスを実現します。
前提条件
- agentic-flow v3.0.0-alpha.1+
- Node.js 18+
- 分散システムに関する知識(あると便利です)
クイックスタート
# Initialize swarm
npx agentic-flow hooks swarm-init --topology mesh --max-agents 5
# Spawn agents
npx agentic-flow hooks agent-spawn --type coder
npx agentic-flow hooks agent-spawn --type tester
npx agentic-flow hooks agent-spawn --type reviewer
# Orchestrate task
npx agentic-flow hooks task-orchestrate \
--task "Build REST API with tests" \
--mode parallel
トポロジーパターン
1. メッシュ型(ピアツーピア)
// Equal peers, distributed decision-making
await swarm.init({
topology: 'mesh',
agents: ['coder', 'tester', 'reviewer'],
communication: 'broadcast'
});
2. 階層型(クイーン・ワーカー)
// Centralized coordination, specialized workers
await swarm.init({
topology: 'hierarchical',
queen: 'architect',
workers: ['backend-dev', 'frontend-dev', 'db-designer']
});
3. 適応型(動的)
// Automatically switches topology based on task
await swarm.init({
topology: 'adaptive',
optimization: 'task-complexity'
});
タスクのオーケストレーション
並列実行
// Execute tasks concurrently
const results = await swarm.execute({
tasks: [
{ agent: 'coder', task: 'Implement API endpoints' },
{ agent: 'frontend', task: 'Build UI components' },
{ agent: 'tester', task: 'Write test suite' }
],
mode: 'parallel',
timeout: 300000 // 5 minutes
});
パイプライン実行
// Sequential pipeline with dependencies
await swarm.pipeline([
{ stage: 'design', agent: 'architect' },
{ stage: 'implement', agent: 'coder', after: 'design' },
{ stage: 'test', agent: 'tester', after: 'implement' },
{ stage: 'review', agent: 'reviewer', after: 'test' }
]);
適応型実行
// Let swarm decide execution strategy
await swarm.autoOrchestrate({
goal: 'Build production-ready API',
constraints: {
maxTime: 3600,
maxAgents: 8,
quality: 'high'
}
});
メモリの連携
// Share state across swarm
await swarm.memory.store('api-schema', {
endpoints: [...],
models: [...]
});
// Agents read shared memory
const schema = await swarm.memory.retrieve('api-schema');
高度な機能
負荷分散
// Automatic work distribution
await swarm.enableLoadBalancing({
strategy: 'dynamic',
metrics: ['cpu', 'memory', 'task-queue']
});
フォールトトレランス
// Handle agent failures
await swarm.setResiliency({
retry: { maxAttempts: 3, backoff: 'exponential' },
fallback: 'reassign-task'
});
パフォーマンスの監視
// Track swarm metrics
const metrics = await swarm.getMetrics();
// { throughput, latency, success_rate, agent_utilization }
Hooks との統合
# Pre-task coordination
npx agentic-flow hooks pre-task --description "Build API"
# Post-task synchronization
npx agentic-flow hooks post-task --task-id "task-123"
# Session restore
npx agentic-flow hooks session-restore --session-id "swarm-001"
ベストプラクティス
- 小さく始める:エージェント 2~3 個から始めて、規模を拡大します
- メモリを使用する:スウォームメモリを通じてコンテキストを共有します
- メトリクスを監視する:パフォーマンスとボトルネックを追跡します
- Hooks を有効にする:連携と同期を自動化します
- タイムアウトを設定する:タスクのハングを防ぎます
トラブルシューティング
問題:エージェントが連携しない
解決策:メモリへのアクセスを確認し、Hooks を有効にします
問題:パフォーマンスが低い
解決策:トポロジーを確認し(適応型を使用)、負荷分散を有効にします
詳細情報
- スウォームガイド:docs/swarm/orchestration.md
- トポロジーパターン:docs/swarm/topologies.md
- Hooks の統合:docs/hooks/coordination.md
コメント
Markdown 対応