Optimize multi-agent systems with coordinated profiling, workload distribution, and cost-aware orchestration. Use when improving agent performance, throughput, or reliability.
Add this skill
npx mdskills install sickn33/agent-orchestration-multi-agent-optimizeComprehensive framework with practical code examples and well-structured optimization strategies
1---2name: agent-orchestration-multi-agent-optimize3description: "Optimize multi-agent systems with coordinated profiling, workload distribution, and cost-aware orchestration. Use when improving agent performance, throughput, or reliability."4---56# Multi-Agent Optimization Toolkit78## Use this skill when910- Improving multi-agent coordination, throughput, or latency11- Profiling agent workflows to identify bottlenecks12- Designing orchestration strategies for complex workflows13- Optimizing cost, context usage, or tool efficiency1415## Do not use this skill when1617- You only need to tune a single agent prompt18- There are no measurable metrics or evaluation data19- The task is unrelated to multi-agent orchestration2021## Instructions22231. Establish baseline metrics and target performance goals.242. Profile agent workloads and identify coordination bottlenecks.253. Apply orchestration changes and cost controls incrementally.264. Validate improvements with repeatable tests and rollbacks.2728## Safety2930- Avoid deploying orchestration changes without regression testing.31- Roll out changes gradually to prevent system-wide regressions.3233## Role: AI-Powered Multi-Agent Performance Engineering Specialist3435### Context3637The Multi-Agent Optimization Tool is an advanced AI-driven framework designed to holistically improve system performance through intelligent, coordinated agent-based optimization. Leveraging cutting-edge AI orchestration techniques, this tool provides a comprehensive approach to performance engineering across multiple domains.3839### Core Capabilities4041- Intelligent multi-agent coordination42- Performance profiling and bottleneck identification43- Adaptive optimization strategies44- Cross-domain performance optimization45- Cost and efficiency tracking4647## Arguments Handling4849The tool processes optimization arguments with flexible input parameters:5051- `$TARGET`: Primary system/application to optimize52- `$PERFORMANCE_GOALS`: Specific performance metrics and objectives53- `$OPTIMIZATION_SCOPE`: Depth of optimization (quick-win, comprehensive)54- `$BUDGET_CONSTRAINTS`: Cost and resource limitations55- `$QUALITY_METRICS`: Performance quality thresholds5657## 1. Multi-Agent Performance Profiling5859### Profiling Strategy6061- Distributed performance monitoring across system layers62- Real-time metrics collection and analysis63- Continuous performance signature tracking6465#### Profiling Agents66671. **Database Performance Agent**68 - Query execution time analysis69 - Index utilization tracking70 - Resource consumption monitoring71722. **Application Performance Agent**73 - CPU and memory profiling74 - Algorithmic complexity assessment75 - Concurrency and async operation analysis76773. **Frontend Performance Agent**78 - Rendering performance metrics79 - Network request optimization80 - Core Web Vitals monitoring8182### Profiling Code Example8384```python85def multi_agent_profiler(target_system):86 agents = [87 DatabasePerformanceAgent(target_system),88 ApplicationPerformanceAgent(target_system),89 FrontendPerformanceAgent(target_system)90 ]9192 performance_profile = {}93 for agent in agents:94 performance_profile[agent.__class__.__name__] = agent.profile()9596 return aggregate_performance_metrics(performance_profile)97```9899## 2. Context Window Optimization100101### Optimization Techniques102103- Intelligent context compression104- Semantic relevance filtering105- Dynamic context window resizing106- Token budget management107108### Context Compression Algorithm109110```python111def compress_context(context, max_tokens=4000):112 # Semantic compression using embedding-based truncation113 compressed_context = semantic_truncate(114 context,115 max_tokens=max_tokens,116 importance_threshold=0.7117 )118 return compressed_context119```120121## 3. Agent Coordination Efficiency122123### Coordination Principles124125- Parallel execution design126- Minimal inter-agent communication overhead127- Dynamic workload distribution128- Fault-tolerant agent interactions129130### Orchestration Framework131132```python133class MultiAgentOrchestrator:134 def __init__(self, agents):135 self.agents = agents136 self.execution_queue = PriorityQueue()137 self.performance_tracker = PerformanceTracker()138139 def optimize(self, target_system):140 # Parallel agent execution with coordinated optimization141 with concurrent.futures.ThreadPoolExecutor() as executor:142 futures = {143 executor.submit(agent.optimize, target_system): agent144 for agent in self.agents145 }146147 for future in concurrent.futures.as_completed(futures):148 agent = futures[future]149 result = future.result()150 self.performance_tracker.log(agent, result)151```152153## 4. Parallel Execution Optimization154155### Key Strategies156157- Asynchronous agent processing158- Workload partitioning159- Dynamic resource allocation160- Minimal blocking operations161162## 5. Cost Optimization Strategies163164### LLM Cost Management165166- Token usage tracking167- Adaptive model selection168- Caching and result reuse169- Efficient prompt engineering170171### Cost Tracking Example172173```python174class CostOptimizer:175 def __init__(self):176 self.token_budget = 100000 # Monthly budget177 self.token_usage = 0178 self.model_costs = {179 'gpt-5': 0.03,180 'claude-4-sonnet': 0.015,181 'claude-4-haiku': 0.0025182 }183184 def select_optimal_model(self, complexity):185 # Dynamic model selection based on task complexity and budget186 pass187```188189## 6. Latency Reduction Techniques190191### Performance Acceleration192193- Predictive caching194- Pre-warming agent contexts195- Intelligent result memoization196- Reduced round-trip communication197198## 7. Quality vs Speed Tradeoffs199200### Optimization Spectrum201202- Performance thresholds203- Acceptable degradation margins204- Quality-aware optimization205- Intelligent compromise selection206207## 8. Monitoring and Continuous Improvement208209### Observability Framework210211- Real-time performance dashboards212- Automated optimization feedback loops213- Machine learning-driven improvement214- Adaptive optimization strategies215216## Reference Workflows217218### Workflow 1: E-Commerce Platform Optimization2192201. Initial performance profiling2212. Agent-based optimization2223. Cost and performance tracking2234. Continuous improvement cycle224225### Workflow 2: Enterprise API Performance Enhancement2262271. Comprehensive system analysis2282. Multi-layered agent optimization2293. Iterative performance refinement2304. Cost-efficient scaling strategy231232## Key Considerations233234- Always measure before and after optimization235- Maintain system stability during optimization236- Balance performance gains with resource consumption237- Implement gradual, reversible changes238239Target Optimization: $ARGUMENTS240
Full transparency — inspect the skill content before installing.