Workflow DAG
A workflow drawn as a directed acyclic graph: steps joined by edges that never loop back, run in the order their inputs allow.
The name lists the three rules. Directed: each edge goes one way, from the step that produces data to the step that uses it. Acyclic: following the edges never brings you back to a step you passed, so no step waits on its own output. Graph: a step can have several inputs and several outputs, so the flow can branch and join, not just run in a line.
Those rules make a DAG predictable. Before anything runs, the engine can sort the steps so that each one comes after everything it depends on (a topological sort). It knows that the run will end, which steps can be reached, and which step to blame when one fails. Branching does not break this: an IF or switch step picks one branch, and the steps on the other branches are skipped.
Example
Webhook ─▶ Classify ─▶ Switch ─┬─▶ Refund steps
├─▶ Create issue
└─▶ Agent ─▶ OutputA sorted order is Webhook, Classify, Switch, then the branches. If someone draws an edge from Output back to Classify, Classify now depends on a step that depends on Classify. No order satisfies that, so the graph is no longer a DAG.
Common confusion
A DAG does not mean "nothing ever repeats". Repetition just does not come from a back-edge. A loop step can run the steps after it once per item in a list, and an agent loopAgent loop: The cycle an AI agent repeats: call the model, run the tools it asks for, add the results to the conversation, then call the model again until it answers. can repeat model and tool calls as often as its limit allows, all inside one step of the graph. The graph stays acyclic; the repetition is bounded by the list length or by max iterationsMax iterations: The most rounds of model call and tool calls an agent may take in one run. When it is reached, the agent stops instead of looping on..
A DAG is also not the opposite of an agent. A common design keeps the outer flow as a DAG and puts an agentAI agent: A system in which a language model decides, step by step, which tools to call and in what order, reading each result before it chooses the next step, until it can answer. in one step, where the work is open-ended.
In L2M
The workflow editor builds a DAG. Validation sorts the nodes and refuses a graph with a cycle ("Workflow graph contains a cycle. V1 supports DAG execution only."), and a node may not have an edge to itself. The engine then runs the nodes one at a time in the sorted order; a node that no execution edge connects is not run. Only execution edges count: attachment edges, such as an agent's chat_model, tool, memory and worker ports, are left out of the sort, because the agent uses those nodes while it runs (attachment ports). For repetition, the Loop / ForEach node runs its direct downstream nodes once per item, up to its own maxIterations (100 when unset).
Further reading
- Building effective agents (Anthropic engineering, December 2024): workflows with predefined code paths versus agents