Skills & Workflow

DAG Workflow

Also called: DAG

A DAG workflow is a workflow modeled as a directed acyclic graph — steps that can branch into parallel paths and later merge back together, with no path ever looping back on itself.

StartBranch ABranch BMerge → End
Independent branches run in parallel, then merge back into one path.

A plain pipeline is a straight line: one stage feeds the next, in order. That's fine as long as every step genuinely depends on the one before it. Often it doesn't: fetching test results and fetching lint results don't depend on each other, but a later “deploy” step depends on both finishing. A DAG (directed acyclic graph) workflow is the way to represent that — steps as nodes, dependencies as directed edges, with branches that split off and later merge back into a single path before the workflow continues.

The “acyclic” part matters as much as the branching: a DAG has no loops. Once an edge points from step A to step B, nothing ever points back from B to A. That's a deliberate constraint — it guarantees the graph has a well-defined starting point and finishing point, and that execution can't get stuck circling. Anything that genuinely needs to loop or revisit earlier states is a different pattern (see state-machine-agent), not a DAG.

This shape is common in build systems and orchestration tools for exactly this reason — it lets independent work run in parallel, which a strictly linear pipeline can't express, while keeping a guarantee that the whole thing terminates.

How it works

Execution typically starts at nodes with no unmet dependencies (the graph's roots) and runs them, often in parallel if the workflow engine supports it. A node with multiple incoming edges — a merge point — only runs once all of its dependencies have completed, at which point the graph continues past it as a single path again.

Example

A CI-style agent workflow: start → run linter (branch A) and run tests (branch B) in parallel → once both finish, merge → deploy. Deploy only starts once both the lint and test branches have completed, whichever finished last.

How it differs

DAG workflow vs. plain pipeline: a pipeline is one linear chain with no branching; a DAG allows independent branches to run in parallel and converge at a merge point, which a plain pipeline has no way to represent.

Common misconceptions

Often assumed: A DAG workflow can loop back to retry an earlier step.
Actually: By definition a DAG has no cycles — nothing loops back. Retry and revisit behavior belongs to a different pattern, like a state-machine-agent or a loop with explicit retry logic outside the DAG.

FAQ

What is a DAG workflow?
A workflow modeled as steps (nodes) and dependencies (directed edges) that can branch into parallel paths and later merge, with no loops back to an earlier step.
Why use a DAG instead of a normal pipeline?
When some steps are independent and can run in parallel but a later step needs all of them finished first — a plain linear pipeline can't represent that, a DAG can.

Last checked: 2026-08-28

Related terms