multi-scenario-orchestration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMulti-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
适用场景
| Scenario | Example |
|---|---|
| Skill demos | Show |
| Progressive testing | Validate skill scales with complexity |
| Comparative analysis | How does approach differ by difficulty? |
| Training/tutorials | Show skill progression from easy to hard |
| 场景 | 示例 |
|---|---|
| Skill演示 | 在简单、中等、复杂任务上展示 |
| 渐进式测试 | 验证Skill能否随复杂度提升保持性能 |
| 对比分析 | 不同难度下的处理方式有何差异? |
| 培训/教程 | 展示Skill从易到难的能力递进 |
Quick Start
快速开始
python
from langgraph.graph import StateGraphpython
from langgraph.graph import StateGraph1. 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
undefinedundefinedScenario Difficulty Scaling
场景难度缩放
| Level | Complexity | Input Size | Time Budget | Quality |
|---|---|---|---|---|
| Simple | 1x | Small (10) | 30s | Basic |
| Medium | 3x | Medium (50) | 90s | Good |
| Complex | 8x | Large (200) | 300s | Excellent |
| 级别 | 复杂度 | 输入规模 | 时间预算 | 质量要求 |
|---|---|---|---|---|
| 简单 | 1倍 | 小(10) | 30秒 | 基础 |
| 中等 | 3倍 | 中(50) | 90秒 | 良好 |
| 复杂 | 8倍 | 大(200) | 300秒 | 优秀 |
Synchronization Modes
同步模式
| Mode | Description | Use When |
|---|---|---|
| Free-running | All run independently | Demo videos |
| Milestone-sync | Wait at 30%, 70%, 100% | Comparative analysis |
| Lock-step | All proceed together | Training |
| 模式 | 描述 | 适用场景 |
|---|---|---|
| 自由运行 | 所有实例独立运行 | 演示视频 |
| 里程碑同步 | 在30%、70%、100%进度点等待 | 对比分析 |
| 锁步同步 | 所有实例同步推进 | 培训场景 |
Key Components
核心组件
- Coordinator - Spawns and monitors 3 instances
- State Manager - Tracks progress per scenario
- Aggregator - Merges results, extracts patterns
- Coordinator(协调器) - 生成并监控3个Skill实例
- State Manager(状态管理器) - 跟踪每个场景的进度
- Aggregator(聚合器) - 合并结果,提取规律
Key Decisions
关键决策
| Decision | Recommendation |
|---|---|
| Synchronization mode | Free-running with checkpoints |
| Scenario count | Always 3: simple, medium, complex |
| Input scaling | 1x, 3x, 8x (exponential) |
| Time budgets | 30s, 90s, 300s |
| Checkpoint frequency | Every 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
- - Supervisor routing pattern
langgraph-supervisor - - Fan-out/fan-in execution
langgraph-parallel - - State management
langgraph-state - - Persistence
langgraph-checkpoints - - Coordination patterns
multi-agent-orchestration
- - 监督者路由模式
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无关模板 - 可复用模板