Multi-Agent Optimization Toolkit
Use this skill when
- - Improving multi-agent coordination, throughput, or latency
- Profiling agent workflows to identify bottlenecks
- Designing orchestration strategies for complex workflows
- Optimizing cost, context usage, or tool efficiency
Do not use this skill when
- - You only need to tune a single agent prompt
- There are no measurable metrics or evaluation data
- The task is unrelated to multi-agent orchestration
Instructions
- 1. Establish baseline metrics and target performance goals.
- Profile agent workloads and identify coordination bottlenecks.
- Apply orchestration changes and cost controls incrementally.
- Validate improvements with repeatable tests and rollbacks.
Safety
- - Avoid deploying orchestration changes without regression testing.
- Roll out changes gradually to prevent system-wide regressions.
Role: AI-Powered Multi-Agent Performance Engineering Specialist
Context
The 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.
Core Capabilities
- - Intelligent multi-agent coordination
- Performance profiling and bottleneck identification
- Adaptive optimization strategies
- Cross-domain performance optimization
- Cost and efficiency tracking
Arguments Handling
The tool processes optimization arguments with flexible input parameters:
- -
$TARGET: Primary system/application to optimize - INLINECODE1 : Specific performance metrics and objectives
- INLINECODE2 : Depth of optimization (quick-win, comprehensive)
- INLINECODE3 : Cost and resource limitations
- INLINECODE4 : Performance quality thresholds
1. Multi-Agent Performance Profiling
Profiling Strategy
- - Distributed performance monitoring across system layers
- Real-time metrics collection and analysis
- Continuous performance signature tracking
Profiling Agents
- 1. Database Performance Agent
- Query execution time analysis
- Index utilization tracking
- Resource consumption monitoring
- 2. Application Performance Agent
- CPU and memory profiling
- Algorithmic complexity assessment
- Concurrency and async operation analysis
- 3. Frontend Performance Agent
- Rendering performance metrics
- Network request optimization
- Core Web Vitals monitoring
Profiling Code Example
CODEBLOCK0
2. Context Window Optimization
Optimization Techniques
- - Intelligent context compression
- Semantic relevance filtering
- Dynamic context window resizing
- Token budget management
Context Compression Algorithm
CODEBLOCK1
3. Agent Coordination Efficiency
Coordination Principles
- - Parallel execution design
- Minimal inter-agent communication overhead
- Dynamic workload distribution
- Fault-tolerant agent interactions
Orchestration Framework
CODEBLOCK2
4. Parallel Execution Optimization
Key Strategies
- - Asynchronous agent processing
- Workload partitioning
- Dynamic resource allocation
- Minimal blocking operations
5. Cost Optimization Strategies
LLM Cost Management
- - Token usage tracking
- Adaptive model selection
- Caching and result reuse
- Efficient prompt engineering
Cost Tracking Example
CODEBLOCK3
6. Latency Reduction Techniques
Performance Acceleration
- - Predictive caching
- Pre-warming agent contexts
- Intelligent result memoization
- Reduced round-trip communication
7. Quality vs Speed Tradeoffs
Optimization Spectrum
- - Performance thresholds
- Acceptable degradation margins
- Quality-aware optimization
- Intelligent compromise selection
8. Monitoring and Continuous Improvement
Observability Framework
- - Real-time performance dashboards
- Automated optimization feedback loops
- Machine learning-driven improvement
- Adaptive optimization strategies
Reference Workflows
Workflow 1: E-Commerce Platform Optimization
- 1. Initial performance profiling
- Agent-based optimization
- Cost and performance tracking
- Continuous improvement cycle
Workflow 2: Enterprise API Performance Enhancement
- 1. Comprehensive system analysis
- Multi-layered agent optimization
- Iterative performance refinement
- Cost-efficient scaling strategy
Key Considerations
- - Always measure before and after optimization
- Maintain system stability during optimization
- Balance performance gains with resource consumption
- Implement gradual, reversible changes
Target Optimization: $ARGUMENTS
技能名称: agent-orchestration-multi-agent-optimize
详细描述:
多智能体优化工具包
何时使用此技能
- - 改善多智能体协调、吞吐量或延迟
- 分析智能体工作流程以识别瓶颈
- 为复杂工作流设计编排策略
- 优化成本、上下文使用或工具效率
何时不使用此技能
- - 仅需调整单个智能体提示词
- 没有可衡量的指标或评估数据
- 任务与多智能体编排无关
操作说明
- 1. 建立基线指标和目标性能目标。
- 分析智能体工作负载并识别协调瓶颈。
- 逐步应用编排变更和成本控制。
- 通过可重复测试和回滚验证改进效果。
安全
- - 未经回归测试,避免部署编排变更。
- 逐步推出变更,防止系统级性能回退。
角色:AI驱动的多智能体性能工程专家
背景
多智能体优化工具是一个先进的AI驱动框架,旨在通过智能、协调的基于智能体的优化,全面提升系统性能。该工具利用尖端的AI编排技术,提供跨多个领域的性能工程综合方法。
核心能力
- - 智能多智能体协调
- 性能分析和瓶颈识别
- 自适应优化策略
- 跨领域性能优化
- 成本和效率跟踪
参数处理
该工具通过灵活的输入参数处理优化参数:
- - $TARGET:待优化的主要系统/应用
- $PERFORMANCEGOALS:具体的性能指标和目标
- $OPTIMIZATIONSCOPE:优化深度(速赢、全面)
- $BUDGETCONSTRAINTS:成本和资源限制
- $QUALITYMETRICS:性能质量阈值
1. 多智能体性能分析
分析策略
- - 跨系统层的分布式性能监控
- 实时指标收集与分析
- 持续性能特征跟踪
分析智能体
- 1. 数据库性能智能体
- 查询执行时间分析
- 索引利用率跟踪
- 资源消耗监控
- 2. 应用性能智能体
- CPU和内存分析
- 算法复杂度评估
- 并发和异步操作分析
- 3. 前端性能智能体
- 渲染性能指标
- 网络请求优化
- 核心网页指标监控
分析代码示例
python
def multiagentprofiler(target_system):
agents = [
DatabasePerformanceAgent(target_system),
ApplicationPerformanceAgent(target_system),
FrontendPerformanceAgent(target_system)
]
performance_profile = {}
for agent in agents:
performance_profile[agent.class.name] = agent.profile()
return aggregateperformancemetrics(performance_profile)
2. 上下文窗口优化
优化技术
- - 智能上下文压缩
- 语义相关性过滤
- 动态上下文窗口大小调整
- Token预算管理
上下文压缩算法
python
def compresscontext(context, maxtokens=4000):
# 使用基于嵌入的截断进行语义压缩
compressedcontext = semantictruncate(
context,
maxtokens=maxtokens,
importance_threshold=0.7
)
return compressed_context
3. 智能体协调效率
协调原则
- - 并行执行设计
- 最小化智能体间通信开销
- 动态工作负载分配
- 容错智能体交互
编排框架
python
class MultiAgentOrchestrator:
def init(self, agents):
self.agents = agents
self.execution_queue = PriorityQueue()
self.performance_tracker = PerformanceTracker()
def optimize(self, target_system):
# 带协调优化的并行智能体执行
with concurrent.futures.ThreadPoolExecutor() as executor:
futures = {
executor.submit(agent.optimize, target_system): agent
for agent in self.agents
}
for future in concurrent.futures.as_completed(futures):
agent = futures[future]
result = future.result()
self.performance_tracker.log(agent, result)
4. 并行执行优化
关键策略
- - 异步智能体处理
- 工作负载分区
- 动态资源分配
- 最小化阻塞操作
5. 成本优化策略
LLM成本管理
- - Token使用跟踪
- 自适应模型选择
- 缓存和结果复用
- 高效提示词工程
成本跟踪示例
python
class CostOptimizer:
def init(self):
self.token_budget = 100000 # 月度预算
self.token_usage = 0
self.model_costs = {
gpt-5: 0.03,
claude-4-sonnet: 0.015,
claude-4-haiku: 0.0025
}
def selectoptimalmodel(self, complexity):
# 基于任务复杂度和预算的动态模型选择
pass
6. 延迟降低技术
性能加速
- - 预测性缓存
- 预预热智能体上下文
- 智能结果记忆化
- 减少往返通信
7. 质量与速度权衡
优化谱系
- - 性能阈值
- 可接受的降级裕度
- 质量感知优化
- 智能折中选择
8. 监控与持续改进
可观测性框架
- - 实时性能仪表盘
- 自动化优化反馈循环
- 机器学习驱动的改进
- 自适应优化策略
参考工作流
工作流1:电商平台优化
- 1. 初始性能分析
- 基于智能体的优化
- 成本和性能跟踪
- 持续改进循环
工作流2:企业API性能增强
- 1. 全面系统分析
- 多层智能体优化
- 迭代性能优化
- 成本高效扩展策略
关键考量
- - 始终在优化前后进行测量
- 在优化过程中保持系统稳定性
- 平衡性能提升与资源消耗
- 实施渐进式、可逆的变更
目标优化:$ARGUMENTS