dependencies field inside a DAG task template. This lesson shows the enhanced depends expression, which adds conditional logic based on other tasks’ results so you can run tasks only when specific conditions are met.
The depends expression uses the syntax:
- taskName.Result — where Result is a status selector (e.g.,
Succeeded,Failed,Skipped,Error,Daemoned) - Or aggregate selectors like
AnySucceededandAllFailed
- OR:
|| - AND:
&& - NOT:
!
- Run
task-2only iftask-1succeeded:
- A more complex expression:
| Selector | Meaning |
|---|---|
| Succeeded | Task completed successfully (exit code 0) |
| Failed | Task completed with non-zero exit code |
| Skipped | Task was skipped/omitted (e.g., depends condition not met) |
| Error | Task errored (system error) |
| Daemoned | Task entered a daemon state (long-running) |
| AnySucceeded | At least one task in a group succeeded |
| AllFailed | All tasks in a group failed |
depends in a DAG with four tasks. Tasks A and B run in parallel; C runs if either A or B succeeds; D runs only if both A and B succeed.
- The
succeedstemplate echoes “I succeeded.” and exits with code 0, so tasks using it reportSucceeded. - The
failstemplate echoes “I failed.” and exits non-zero, so tasks using it reportFailed. - The
echo-messagetemplate prints the providedmessageparameter.
- Tasks A and B have no dependencies and start in parallel.
- Task C uses
depends: "A.Succeeded || B.Succeeded"— it runs if either A or B succeeds. - Task D uses
depends: "A.Succeeded && B.Succeeded"— it runs only if both A and B succeed.
- C runs because at least one of A or B succeeded.
- D is skipped because both did not succeed. The UI shows D as Skipped/Omitted with the message “depends condition not met.”

depends expressions (patterns you can reuse):
| Common Pitfalls | Recommendation | ||
|---|---|---|---|
Forgetting YAML quoting for the depends expression | Always wrap the expression in quotes to avoid YAML parsing issues with ` | , &&, and !`. | |
Mixing dependencies and depends on the same task | Use one or the other. Convert dependencies: [A, B, C] to depends: "A && B && C" if you need the depends syntax. |
Use quotes around the
depends expression so YAML treats operators (||, &&, !) correctly. depends supports boolean operators and selectors like Succeeded, Failed, Skipped, Daemoned, AnySucceeded, AllFailed.Do not use both
dependencies and depends on the same task. To convert dependencies: [A, B, C] into depends, use: depends: "A && B && C".- Argo Workflows documentation
- For more DAG patterns and examples, consult the Argo docs and community examples.