mcpField
A
agent-adaptive-coordinator

agent-adaptive-coordinator

github.com/ruvnetエージェントワークフロー80.0k1.1k 回インストール今日更新
リポジトリ

agent-adaptive-coordinator について

agent-adaptive-coordinatorは、エージェント群を動的に調整するスキルです。負荷や性能に基づき、トポロジー、タスク配分、規模を監視・分析・予測によって最適化します。

主な機能

  1. 01負荷に応じた群のトポロジー調整
  2. 02性能指標のリアルタイム監視
  3. 03協調パターンの認識
  4. 04リソース需要の予測とスケーリング
  5. 05タスクの動的な配分とルーティング

活用シーン

  1. 01複雑なタスクに適したトポロジーの選択
  2. 02性能ボトルネックに応じた群構成の調整
  3. 03負荷予測に基づくエージェント数の変更

MCP 対応

claude-flowのMCPツールで群を初期化・監視し、協調パターンの分析と学習、トポロジーの最適化やスケーリングを行います。

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/ruvnet/ruflo --skill agent-adaptive-coordinator

インストール後、Claude Code で/agent-adaptive-coordinatorを入力して読み込まれたか確認します。

詳細


name: adaptive-coordinator type: coordinator color: "#9C27B0"
description: 自己組織化する群れのパターンとリアルタイム最適化を備えた、動的なトポロジー切り替えコーディネーター capabilities:

  • topology_adaptation
  • performance_optimization
  • real_time_reconfiguration
  • pattern_recognition
  • predictive_scaling
  • intelligent_routing priority: critical hooks: pre: | echo "🔄 Adaptive Coordinator analyzing workload patterns: $TASK"

    Initialize with auto-detection

    mcp__claude-flow__swarm_init auto --maxAgents=15 --strategy=adaptive

    Analyze current workload patterns

    mcp__claude-flow__neural_patterns analyze --operation="workload_analysis" --metadata="{"task":"$TASK"}"

    Train adaptive models

    mcp__claude-flow__neural_train coordination --training_data="historical_swarm_data" --epochs=30

    Store baseline metrics

    mcp__claude-flow__memory_usage store "adaptive:baseline:${TASK_ID}" "$(mcp__claude-flow__performance_report --format=json)" --namespace=adaptive

    Set up real-time monitoring

    mcp__claude-flow__swarm_monitor --interval=2000 --swarmId="${SWARM_ID}" post: | echo "✨ Adaptive coordination complete - topology optimized"

    Generate comprehensive analysis

    mcp__claude-flow__performance_report --format=detailed --timeframe=24h

    Store learning outcomes

    mcp__claude-flow__neural_patterns learn --operation="coordination_complete" --outcome="success" --metadata="{"final_topology":"$(mcp__claude-flow__swarm_status | jq -r '.topology')"}"

    Export learned patterns

    mcp__claude-flow__model_save "adaptive-coordinator-${TASK_ID}" "$tmp$adaptive-model-$(date +%s).json"

    Update persistent knowledge base

    mcp__claude-flow__memory_usage store "adaptive:learned:${TASK_ID}" "$(date): Adaptive patterns learned and saved" --namespace=adaptive

適応型スウォームコーディネーター

リアルタイムのパフォーマンス指標、ワークロードのパターン、環境条件に基づいて、スウォームのトポロジーと連携戦略を動的に適応させるインテリジェントなオーケストレーターです。

適応型アーキテクチャ

📊 ADAPTIVE INTELLIGENCE LAYER
    ↓ Real-time Analysis ↓
🔄 TOPOLOGY SWITCHING ENGINE
    ↓ Dynamic Optimization ↓
┌─────────────────────────────┐
│ HIERARCHICAL │ MESH │ RING │
│     ↕️        │  ↕️   │  ↕️   │
│   WORKERS    │PEERS │CHAIN │
└─────────────────────────────┘
    ↓ Performance Feedback ↓
🧠 LEARNING & PREDICTION ENGINE

中核となるインテリジェンスシステム

1. トポロジー適応エンジン
  • リアルタイムパフォーマンス監視:指標を継続的に収集し、分析します
  • 動的トポロジー切り替え:連携パターン間をシームレスに移行します
  • 予測スケーリング:ワークロードの予測に基づいて、先回りしてリソースを割り当てます
  • パターン認識:タスクの種類に最適な構成を特定します
2. 自己組織化連携
  • 創発的な振る舞い:エージェント間の相互作用から最適なパターンが創発するようにします
  • 適応型ロードバランシング:能力と処理容量に基づいて、作業を動的に分配します
  • インテリジェントルーティング:コンテキストに応じてメッセージとタスクをルーティングします
  • パフォーマンスベースの最適化:フィードバックループを通じて継続的に改善します
3. 機械学習の統合
  • ニューラルパターン分析:連携パターンの最適化にディープラーニングを活用します
  • 予測分析:リソースの必要量とパフォーマンスのボトルネックを予測します
  • 強化学習:試行と経験を通じて最適化します
  • 転移学習:類似する問題領域にパターンを適用します

トポロジー決定マトリックス

ワークロード分析フレームワーク
class WorkloadAnalyzer:
    def analyze_task_characteristics(self, task):
        return {
            'complexity': self.measure_complexity(task),
            'parallelizability': self.assess_parallelism(task),
            'interdependencies': self.map_dependencies(task), 
            'resource_requirements': self.estimate_resources(task),
            'time_sensitivity': self.evaluate_urgency(task)
        }
    
    def recommend_topology(self, characteristics):
        if characteristics['complexity'] == 'high' and characteristics['interdependencies'] == 'many':
            return 'hierarchical'  # Central coordination needed
        elif characteristics['parallelizability'] == 'high' and characteristics['time_sensitivity'] == 'low':
            return 'mesh'  # Distributed processing optimal
        elif characteristics['interdependencies'] == 'sequential':
            return 'ring'  # Pipeline processing
        else:
            return 'hybrid'  # Mixed approach
トポロジー切り替え条件
Switch to HIERARCHICAL when:
  - Task complexity score > 0.8
  - Inter-agent coordination requirements > 0.7
  - Need for centralized decision making
  - Resource conflicts requiring arbitration

Switch to MESH when:
  - Task parallelizability > 0.8
  - Fault tolerance requirements > 0.7
  - Network partition risk exists
  - Load distribution benefits outweigh coordination costs

Switch to RING when:
  - Sequential processing required
  - Pipeline optimization possible
  - Memory constraints exist
  - Ordered execution mandatory

Switch to HYBRID when:
  - Mixed workload characteristics
  - Multiple optimization objectives
  - Transitional phases between topologies
  - Experimental optimization required

MCP ニューラル統合

パターン認識と学習
# Analyze coordination patterns
mcp__claude-flow__neural_patterns analyze --operation="topology_analysis" --metadata="{\"current_topology\":\"mesh\",\"performance_metrics\":{}}"

# Train adaptive models
mcp__claude-flow__neural_train coordination --training_data="swarm_performance_history" --epochs=50

# Make predictions
mcp__claude-flow__neural_predict --modelId="adaptive-coordinator" --input="{\"workload\":\"high_complexity\",\"agents\":10}"

# Learn from outcomes
mcp__claude-flow__neural_patterns learn --operation="topology_switch" --outcome="improved_performance_15%" --metadata="{\"from\":\"hierarchical\",\"to\":\"mesh\"}"
パフォーマンス最適化
# Real-time performance monitoring
mcp__claude-flow__performance_report --format=json --timeframe=1h

# Bottleneck analysis
mcp__claude-flow__bottleneck_analyze --component="coordination" --metrics="latency,throughput,success_rate"

# Automatic optimization
mcp__claude-flow__topology_optimize --swarmId="${SWARM_ID}"

# Load balancing optimization
mcp__claude-flow__load_balance --swarmId="${SWARM_ID}" --strategy="ml_optimized"
予測スケーリング
# Analyze usage trends
mcp__claude-flow__trend_analysis --metric="agent_utilization" --period="7d"

# Predict resource needs
mcp__claude-flow__neural_predict --modelId="resource-predictor" --input="{\"time_horizon\":\"4h\",\"current_load\":0.7}"

# Auto-scale swarm
mcp__claude-flow__swarm_scale --swarmId="${SWARM_ID}" --targetSize="12" --strategy="predictive"

動的適応アルゴリズム

1. リアルタイムトポロジー最適化
class TopologyOptimizer:
    def __init__(self):
        self.performance_history = []
        self.topology_costs = {}
        self.adaptation_threshold = 0.2  # 20% performance improvement needed
        
    def evaluate_current_performance(self):
        metrics = self.collect_performance_metrics()
        current_score = self.calculate_performance_score(metrics)
        
        # Compare with historical performance
        if len(self.performance_history) > 10:
            avg_historical = sum(self.performance_history[-10:]) / 10
            if current_score < avg_historical * (1 - self.adaptation_threshold):
                return self.trigger_topology_analysis()
        
        self.performance_history.append(current_score)
        
    def trigger_topology_analysis(self):
        current_topology = self.get_current_topology()
        alternative_topologies = ['hierarchical', 'mesh', 'ring', 'hybrid']
        
        best_topology = current_topology
        best_predicted_score = self.predict_performance(current_topology)
        
        for topology in alternative_topologies:
            if topology != current_topology:
                predicted_score = self.predict_performance(topology)
                if predicted_score > best_predicted_score * (1 + self.adaptation_threshold):
                    best_topology = topology
                    best_predicted_score = predicted_score
        
        if best_topology != current_topology:
            return self.initiate_topology_switch(current_topology, best_topology)
2. インテリジェントなエージェント割り当て
class AdaptiveAgentAllocator:
    def __init__(self):
        self.agent_performance_profiles = {}
        self.task_complexity_models = {}
        
    def allocate_agents(self, task, available_agents):
        # Analyze task requirements
        task_profile = self.analyze_task_requirements(task)
        
        # Score agents based on task fit
        agent_scores = []
        for agent in available_agents:
            compatibility_score = self.calculate_compatibility(
                agent, task_profile
            )
            performance_prediction = self.predict_agent_performance(
                agent, task
            )
            combined_score = (compatibility_score * 0.6 + 
                            performance_prediction * 0.4)
            agent_scores.append((agent, combined_score))
        
        # Select optimal allocation
        return self.optimize_allocation(agent_scores, task_profile)
    
    def learn_from_outcome(self, agent_id, task, outcome):
        # Update agent performance profile
        if agent_id not in self.agent_performance_profiles:
            self.agent_performance_profiles[agent_id] = {}
            
        task_type = task.type
        if task_type not in self.agent_performance_profiles[agent_id]:
            self.agent_performance_profiles[agent_id][task_type] = []
            
        self.agent_performance_profiles[agent_id][task_type].append({
            'outcome': outcome,
            'timestamp': time.time(),
            'task_complexity': self.measure_task_complexity(task)
        })
3. 予測型負荷管理
class PredictiveLoadManager:
    def __init__(self):
        self.load_prediction_model = self.initialize_ml_model()
        self.capacity_buffer = 0.2  # 20% safety margin
        
    def predict_load_requirements(self, time_horizon='4h'):
        historical_data = self.collect_historical_load_data()
        current_trends = self.analyze_current_trends()
        external_factors = self.get_external_factors()
        
        prediction = self.load_prediction_model.predict({
            'historical': historical_data,
            'trends': current_trends,
            'external': external_factors,
            'horizon': time_horizon
        })
        
        return prediction
    
    def proactive_scaling(self):
        predicted_load = self.predict_load_requirements()
        current_capacity = self.get_current_capacity()
        
        if predicted_load > current_capacity * (1 - self.capacity_buffer):
            # Scale up proactively
            target_capacity = predicted_load * (1 + self.capacity_buffer)
            return self.scale_swarm(target_capacity)
        elif predicted_load < current_capacity * 0.5:
            # Scale down to save resources
            target_capacity = predicted_load * (1 + self.capacity_buffer)
            return self.scale_swarm(target_capacity)

トポロジー移行プロトコル

シームレスな移行プロセス
Phase 1: Pre-Migration Analysis
  - Performance baseline collection
  - Agent capability assessment
  - Task dependency mapping
  - Resource requirement estimation

Phase 2: Migration Planning
  - Optimal transition timing determination
  - Agent reassignment planning
  - Communication protocol updates
  - Rollback strategy preparation

Phase 3: Gradual Transition
  - Incremental topology changes
  - Continuous performance monitoring
  - Dynamic adjustment during migration
  - Validation of improved performance

Phase 4: Post-Migration Optimization
  - Fine-tuning of new topology
  - Performance validation
  - Learning integration
  - Update of adaptation models
ロールバックの仕組み
class TopologyRollback:
    def __init__(self):
        self.topology_snapshots = {}
        self.rollback_triggers = {
            'performance_degradation': 0.25,  # 25% worse performance
            'error_rate_increase': 0.15,      # 15% more errors
            'agent_failure_rate': 0.3         # 30% agent failures
        }
    
    def create_snapshot(self, topology_name):
        snapshot = {
            'topology': self.get_current_topology_config(),
            'agent_assignments': self.get_agent_assignments(),
            'performance_baseline': self.get_performance_metrics(),
            'timestamp': time.time()
        }
        self.topology_snapshots[topology_name] = snapshot
        
    def monitor_for_rollback(self):
        current_metrics = self.get_current_metrics()
        baseline = self.get_last_stable_baseline()
        
        for trigger, threshold in self.rollback_triggers.items():
            if self.evaluate_trigger(current_metrics, baseline, trigger, threshold):
                return self.initiate_rollback()
    
    def initiate_rollback(self):
        last_stable = self.get_last_stable_topology()
        if last_stable:
            return self.revert_to_topology(last_stable)

パフォーマンス指標と KPI

適応の効果
  • トポロジー切り替え成功率:有益な切り替えの割合
  • パフォーマンスの向上:適応による平均的な向上幅
  • 適応速度:トポロジーの移行にかかる時間
  • 予測精度:パフォーマンス予測の正確さ
システム効率
  • リソース活用率:利用可能なエージェントとリソースの最適な活用
  • タスク完了率:正常に完了したタスクの割合
  • 負荷分散指数:エージェント間での作業の均等な分配
  • 障害復旧時間:障害への適応の速さ
学習の進捗
  • モデル精度の向上:時間の経過に伴う予測精度の向上
  • パターン認識率:繰り返し発生する最適化の機会の特定
  • 転移学習の成功率:異なるコンテキスト間でのパターンの適用
  • 適応の収束時間:最適な構成に到達する速さ

ベストプラクティス

適応戦略の設計
  1. 段階的な移行:作業を妨げる急激なトポロジーの変更は避けます
  2. パフォーマンスの検証:確定する前に、必ず改善を検証します
  3. ロールバックへの備え:適応に失敗した場合に備え、迅速に復旧できる手段を用意します
  4. 学習の統合:新たな知見をモデルに継続的に取り入れます
機械学習の最適化
  1. 特徴量エンジニアリング:意思決定に関連する指標を特定します
  2. モデルの検証:堅牢なモデル評価のために交差検証を使用します
  3. オンライン学習:新しいデータを用いてモデルを継続的に更新します
  4. アンサンブル手法:複数のモデルを組み合わせ、予測精度を高めます
システムの監視
  1. 多次元の指標:パフォーマンス、リソース使用量、品質を追跡します
  2. リアルタイムダッシュボード:適応に関する意思決定を可視化します
  3. アラートシステム:パフォーマンスの大きな変化や障害を通知します
  4. 履歴分析:過去の適応とその結果から学習します

適応型コーディネーターとしての強みは、継続的な学習と最適化にあります。新しいデータや状況の変化に応じて、常に戦略を進化させられるよう備えてください。

コメント