multi-scenario-orchestration

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Multi-Scenario Orchestration

多场景编排

Design patterns for showcasing one skill across 3 parallel scenarios with synchronized execution and progressive difficulty.
在3个并行场景中展示单个Skill的设计模式,支持同步执行与难度递进。

Core Pattern

核心模式

┌─────────────────────────────────────────────────────────────────────┐
│                   MULTI-SCENARIO ORCHESTRATOR                        │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│  [Coordinator] ──┬─→ [Scenario 1: Simple]       (Easy)            │
│       ▲          │      └─→ [Skill Instance 1]                    │
│       │          ├─→ [Scenario 2: Medium]       (Intermediate)    │
│       │          │      └─→ [Skill Instance 2]                    │
│       │          └─→ [Scenario 3: Complex]      (Advanced)        │
│       │                 └─→ [Skill Instance 3]                    │
│       │                                                             │
│   [State Manager] ◄──── All instances report progress              │
│   [Aggregator] ─→ Cross-scenario synthesis                         │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────┐
│                   MULTI-SCENARIO ORCHESTRATOR                        │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│  [Coordinator] ──┬─→ [Scenario 1: Simple]       (Easy)            │
│       ▲          │      └─→ [Skill Instance 1]                    │
│       │          ├─→ [Scenario 2: Medium]       (Intermediate)    │
│       │          │      └─→ [Skill Instance 2]                    │
│       │          └─→ [Scenario 3: Complex]      (Advanced)        │
│       │                 └─→ [Skill Instance 3]                    │
│       │                                                             │
│   [State Manager] ◄──── All instances report progress              │
│   [Aggregator] ─→ Cross-scenario synthesis                         │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘

When to Use

适用场景

ScenarioExample
Skill demosShow
/implement
on simple, medium, complex tasks
Progressive testingValidate skill scales with complexity
Comparative analysisHow does approach differ by difficulty?
Training/tutorialsShow skill progression from easy to hard
场景示例
Skill演示在简单、中等、复杂任务上展示
/implement
渐进式测试验证Skill能否随复杂度提升保持性能
对比分析不同难度下的处理方式有何差异?
培训/教程展示Skill从易到难的能力递进

Quick Start

快速开始

python
from langgraph.graph import StateGraph
python
from langgraph.graph import StateGraph

1. Define 3 scenarios with progressive difficulty

1. Define 3 scenarios with progressive difficulty

scenarios = [ {"name": "simple", "complexity": 1.0, "input_size": 10}, {"name": "medium", "complexity": 3.0, "input_size": 50}, {"name": "complex", "complexity": 8.0, "input_size": 200}, ]
scenarios = [ {"name": "simple", "complexity": 1.0, "input_size": 10}, {"name": "medium", "complexity": 3.0, "input_size": 50}, {"name": "complex", "complexity": 8.0, "input_size": 200}, ]

2. Fan out to parallel execution

2. Fan out to parallel execution

3. Aggregate results

3. Aggregate results

4. Report comparative metrics

4. Report comparative metrics

undefined
undefined

Scenario Difficulty Scaling

场景难度缩放

LevelComplexityInput SizeTime BudgetQuality
Simple1xSmall (10)30sBasic
Medium3xMedium (50)90sGood
Complex8xLarge (200)300sExcellent
级别复杂度输入规模时间预算质量要求
简单1倍小(10)30秒基础
中等3倍中(50)90秒良好
复杂8倍大(200)300秒优秀

Synchronization Modes

同步模式

ModeDescriptionUse When
Free-runningAll run independentlyDemo videos
Milestone-syncWait at 30%, 70%, 100%Comparative analysis
Lock-stepAll proceed togetherTraining
模式描述适用场景
自由运行所有实例独立运行演示视频
里程碑同步在30%、70%、100%进度点等待对比分析
锁步同步所有实例同步推进培训场景

Key Components

核心组件

  1. Coordinator - Spawns and monitors 3 instances
  2. State Manager - Tracks progress per scenario
  3. Aggregator - Merges results, extracts patterns
  1. Coordinator(协调器) - 生成并监控3个Skill实例
  2. State Manager(状态管理器) - 跟踪每个场景的进度
  3. Aggregator(聚合器) - 合并结果,提取规律

Key Decisions

关键决策

DecisionRecommendation
Synchronization modeFree-running with checkpoints
Scenario countAlways 3: simple, medium, complex
Input scaling1x, 3x, 8x (exponential)
Time budgets30s, 90s, 300s
Checkpoint frequencyEvery milestone + completion
决策项推荐方案
同步模式带检查点的自由运行模式
场景数量固定为3个:简单、中等、复杂
输入规模缩放1倍、3倍、8倍(指数级)
时间预算30秒、90秒、300秒
检查点频率每个里程碑节点+完成时

Common Mistakes

常见误区

  • Sequential instead of parallel: Defeats purpose. Always fan-out.
  • No synchronization: Results appear disjointed.
  • Unclear difficulty scaling: Differ in scale, not approach.
  • Missing aggregation: Individual results lack comparative insights.
  • 串行而非并行执行:违背设计初衷,必须采用扇出模式。
  • 未设置同步机制:结果显得零散无关联。
  • 难度缩放不清晰:仅在规模上差异,而非处理方式。
  • 缺少聚合步骤:单独结果无法提供对比洞察。

Related Skills

相关Skill

  • langgraph-supervisor
    - Supervisor routing pattern
  • langgraph-parallel
    - Fan-out/fan-in execution
  • langgraph-state
    - State management
  • langgraph-checkpoints
    - Persistence
  • multi-agent-orchestration
    - Coordination patterns
  • langgraph-supervisor
    - 监督者路由模式
  • langgraph-parallel
    - 扇出/扇入执行
  • langgraph-state
    - 状态管理
  • langgraph-checkpoints
    - 持久化
  • multi-agent-orchestration
    - 协调模式

References

参考资料

  • Architectural Patterns - Full architecture
  • State Machine Design - LangGraph state
  • LangGraph Implementation - Code examples
  • Claude Code Instance Management - Multi-instance
  • Skill-Agnostic Template - Reusable template
  • 架构模式 - 完整架构说明
  • 状态机设计 - LangGraph状态设计
  • LangGraph实现 - 代码示例
  • Claude代码实例管理 - 多实例管理
  • Skill无关模板 - 可复用模板