Module 6: Sub-AgentsLesson 3 of 7

Coordination Patterns

Coordination Patterns

How the coordinator and workers communicate.

Pattern 1: Fire and Forget

The simplest pattern.

Coordinator → spawns task → Worker Worker executes → delivers results → done Coordinator continues working

Use when:

  • Task is self-contained
  • Results can be delivered asynchronously
  • No need for back-and-forth

Example:

"Research the top 5 productivity apps and send me a summary"

Pattern 2: Request-Response

Worker returns to coordinator.

Coordinator → spawns task → Worker Coordinator continues other work... Worker → returns results → Coordinator Coordinator processes and continues

Use when:

  • Coordinator needs results to continue
  • Multiple workers in parallel
  • Results need synthesis

Example:

"Research A, B, C — I'll synthesize when all return"

Pattern 3: Pipeline

Output of one feeds into another.

  1. Coordinator → spawns → Worker 1 (Research)
  2. Worker 1 returns research → Coordinator
  3. Coordinator → spawns → Worker 2 (Analysis with research data)
  4. Worker 2 returns analysis → Coordinator
  5. Coordinator produces final output

Use when:

  • Tasks have dependencies
  • Each stage transforms data
  • Sequential processing needed

Example:

"Research competitors, then analyze their pricing strategies"

Pattern 4: Parallel Fan-Out

Multiple workers, same task type.

Coordinator spawns simultaneously:

  • Worker 1 → Competitor A
  • Worker 2 → Competitor B
  • Worker 3 → Competitor C

All run in parallel → All return results → Coordinator synthesizes

Use when:

  • Same task, different inputs
  • Tasks are independent
  • Speed matters (parallel = faster)

Example:

"Research 5 competitors simultaneously"

Implementation in OpenClaw

// Fire and Forget sessions_spawn({ task: "Research X and deliver to Telegram", model: "sonnet" }); // Request-Response (with timeout) const result = await sessions_spawn({ task: "Research X and return results", model: "sonnet", timeoutSeconds: 300 }); // Use result... // Parallel (multiple spawns) const tasks = ["A", "B", "C"].map(item => sessions_spawn({ task: `Research ${item}` }) ); const results = await Promise.all(tasks);