agent-orchestration-multi-agent-optimize

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

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.
  2. Profile agent workloads and identify coordination bottlenecks.
  3. Apply orchestration changes and cost controls incrementally.
  4. Validate improvements with repeatable tests and rollbacks.
  1. 建立基准指标和目标性能目标。
  2. 分析智能体工作负载并识别协调瓶颈。
  3. 逐步应用编排变更和成本控制措施。
  4. 通过可重复测试验证改进效果并支持回滚。

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

角色:AI驱动的多智能体性能工程专家

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.
Multi-Agent Optimization Tool是一个先进的AI驱动框架,旨在通过智能、协调的基于智能体的优化全面提升系统性能。该工具利用前沿的AI编排技术,为多个领域提供全面的性能工程方法。

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
  • $PERFORMANCE_GOALS
    : Specific performance metrics and objectives
  • $OPTIMIZATION_SCOPE
    : Depth of optimization (quick-win, comprehensive)
  • $BUDGET_CONSTRAINTS
    : Cost and resource limitations
  • $QUALITY_METRICS
    : Performance quality thresholds
该工具通过灵活的输入参数处理优化参数:
  • $TARGET
    :待优化的核心系统/应用
  • $PERFORMANCE_GOALS
    :具体的性能指标与目标
  • $OPTIMIZATION_SCOPE
    :优化深度(快速见效、全面优化)
  • $BUDGET_CONSTRAINTS
    :成本与资源限制
  • $QUALITY_METRICS
    :性能质量阈值

1. Multi-Agent Performance Profiling

1. 多智能体性能分析

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
  1. Database Performance Agent
    • 查询执行时间分析
    • 索引利用率跟踪
    • 资源消耗监控
  2. Application Performance Agent
    • CPU与内存分析
    • 算法复杂度评估
    • 并发与异步操作分析
  3. Frontend Performance Agent
    • 渲染性能指标
    • 网络请求优化
    • Core Web Vitals监控

Profiling Code Example

分析代码示例

python
def multi_agent_profiler(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 aggregate_performance_metrics(performance_profile)
python
def multi_agent_profiler(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 aggregate_performance_metrics(performance_profile)

2. Context Window Optimization

2. 上下文窗口优化

Optimization Techniques

优化技术

  • Intelligent context compression
  • Semantic relevance filtering
  • Dynamic context window resizing
  • Token budget management
  • 智能上下文压缩
  • 语义相关性过滤
  • 动态上下文窗口调整
  • Token预算管理

Context Compression Algorithm

上下文压缩算法

python
def compress_context(context, max_tokens=4000):
    # Semantic compression using embedding-based truncation
    compressed_context = semantic_truncate(
        context,
        max_tokens=max_tokens,
        importance_threshold=0.7
    )
    return compressed_context
python
def compress_context(context, max_tokens=4000):
    # Semantic compression using embedding-based truncation
    compressed_context = semantic_truncate(
        context,
        max_tokens=max_tokens,
        importance_threshold=0.7
    )
    return compressed_context

3. Agent Coordination Efficiency

3. 智能体协调效率

Coordination Principles

协调原则

  • Parallel execution design
  • Minimal inter-agent communication overhead
  • Dynamic workload distribution
  • Fault-tolerant agent interactions
  • 并行执行设计
  • 最小化智能体间通信开销
  • 动态工作负载分配
  • 容错性智能体交互

Orchestration Framework

编排框架

python
class MultiAgentOrchestrator:
    def __init__(self, agents):
        self.agents = agents
        self.execution_queue = PriorityQueue()
        self.performance_tracker = PerformanceTracker()

    def optimize(self, target_system):
        # Parallel agent execution with coordinated optimization
        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)
python
class MultiAgentOrchestrator:
    def __init__(self, agents):
        self.agents = agents
        self.execution_queue = PriorityQueue()
        self.performance_tracker = PerformanceTracker()

    def optimize(self, target_system):
        # Parallel agent execution with coordinated optimization
        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. Parallel Execution Optimization

4. 并行执行优化

Key Strategies

关键策略

  • Asynchronous agent processing
  • Workload partitioning
  • Dynamic resource allocation
  • Minimal blocking operations
  • 异步智能体处理
  • 工作负载分区
  • 动态资源分配
  • 最小化阻塞操作

5. Cost Optimization Strategies

5. 成本优化策略

LLM Cost Management

LLM成本管理

  • Token usage tracking
  • Adaptive model selection
  • Caching and result reuse
  • Efficient prompt engineering
  • Token使用跟踪
  • 自适应模型选择
  • 缓存与结果复用
  • 高效提示词工程

Cost Tracking Example

成本跟踪示例

python
class CostOptimizer:
    def __init__(self):
        self.token_budget = 100000  # Monthly budget
        self.token_usage = 0
        self.model_costs = {
            'gpt-5': 0.03,
            'claude-4-sonnet': 0.015,
            'claude-4-haiku': 0.0025
        }

    def select_optimal_model(self, complexity):
        # Dynamic model selection based on task complexity and budget
        pass
python
class CostOptimizer:
    def __init__(self):
        self.token_budget = 100000  # Monthly budget
        self.token_usage = 0
        self.model_costs = {
            'gpt-5': 0.03,
            'claude-4-sonnet': 0.015,
            'claude-4-haiku': 0.0025
        }

    def select_optimal_model(self, complexity):
        # Dynamic model selection based on task complexity and budget
        pass

6. Latency Reduction Techniques

6. 延迟降低技术

Performance Acceleration

性能加速

  • Predictive caching
  • Pre-warming agent contexts
  • Intelligent result memoization
  • Reduced round-trip communication
  • 预测性缓存
  • 智能体上下文预加载
  • 智能结果记忆化
  • 减少往返通信

7. Quality vs Speed Tradeoffs

7. 质量与速度的权衡

Optimization Spectrum

优化范围

  • Performance thresholds
  • Acceptable degradation margins
  • Quality-aware optimization
  • Intelligent compromise selection
  • 性能阈值
  • 可接受的降级幅度
  • 质量感知优化
  • 智能折衷选择

8. Monitoring and Continuous Improvement

8. 监控与持续改进

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:电商平台优化

  1. Initial performance profiling
  2. Agent-based optimization
  3. Cost and performance tracking
  4. Continuous improvement cycle
  1. 初始性能分析
  2. 基于智能体的优化
  3. 成本与性能跟踪
  4. 持续改进周期

Workflow 2: Enterprise API Performance Enhancement

工作流2:企业API性能提升

  1. Comprehensive system analysis
  2. Multi-layered agent optimization
  3. Iterative performance refinement
  4. Cost-efficient scaling strategy
  1. 全面系统分析
  2. 多层智能体优化
  3. 迭代性能优化
  4. 成本高效的扩展策略

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
  • 优化前后务必进行测量
  • 优化期间保持系统稳定性
  • 平衡性能提升与资源消耗
  • 实施渐进式、可回滚的变更
目标优化:$ARGUMENTS