Parallel Workstreams in Java Agent Pipelines: Phase-Level Grouping and DAG Execution
Flat task lists work well for sequential pipelines. You define tasks, wire context dependencies, and the framework runs them in order. For a research-then-write pipeline, that's all you need. The p...

Source: DEV Community
Flat task lists work well for sequential pipelines. You define tasks, wire context dependencies, and the framework runs them in order. For a research-then-write pipeline, that's all you need. The problem shows up when you have work that genuinely doesn't need to happen in sequence -- multiple independent workstreams that can proceed in parallel, followed by a convergence point where all of them must finish before the next stage can begin. The task-level context() mechanism can model some of this. The parallel workflow executor infers a dependency graph from context declarations and runs independent tasks concurrently. But it operates at the individual task level. There's no concept of a named workstream, no defined barrier, and no way to say "these three groups of tasks run at the same time, and this fourth group waits for all three." That gap is what the Phase abstraction addresses in AgentEnsemble. The Kitchen Problem Before getting to code, it helps to have a concrete example of wha