Multi-Agent

Scatter-Gather Plus Saga

Distribute tasks across worker agents and aggregate results while maintaining distributed-transaction semantics via compensating actions on partial failure.

Problem

Without saga semantics, partial failures in a fan-out leave half-committed state. The system has no way to recover atomically: workers already committed cannot un-commit, and there is no coordinator that knows which compensating actions to run. Distinct from parallelization (no transactional model) and map-reduce (assumes pure).

Solution

Each worker exposes (do_action, compensate_action). Coordinator dispatches all workers in parallel. On all-success, gather and return. On any failure, coordinator runs compensate_action for all workers that already committed. Reports outcome as atomic: either all committed (and gathered) or none. Pair with compensating-action, parallelization, map-reduce, supervisor-plus-gate.

When to use

  • Parallel fan-out where partial failures must be rolled back atomically.
  • Each worker has a defined compensating action.
  • Cost of partial-state failure exceeds cost of saga overhead.

Open the full interactive page

Diagram, neighbourhood map, code examples, related patterns and full provenance.

Related