Sequential — when stages depend
Use when: output of stage N is input to stage N+1. Predictable latency, easy to debug. Downside: no parallelism, and one slow stage blocks the whole chain.
Parallel — when stages don't depend
Use when: N specialists can work on the same input independently. Latency = slowest branch. Downside: N times the cost, harder failure modes.
Loop — when quality needs iteration
Use when: 'draft, critique, revise' improves quality. Unpredictable latency, always cap iterations. Downside: hard to reason about cost.
Hierarchical — when domains diverge
Use when: your system has 5+ distinct capabilities. Supervisor routes, workers execute. Downside: extra model call at the supervisor level.
Mixed patterns are normal
// Supervisor decides which workflow to run.
// The chosen workflow may itself be sequential or parallel.
if (task.type() == TaskType.RESEARCH) {
return parallelResearchers.invoke(task);
} else if (task.type() == TaskType.WRITE) {
return draftReviseChain.invoke(task);
}Start simple
Chain first. Add parallelism only where you measured a bottleneck. Add hierarchy only when you have 5+ capabilities. Add loops only when quality demands it. Complexity is easy to add and impossible to remove.