Skip to main content
Every entry in spec.templates is a Template union: exactly one of dag, task, or loop must be set. The engine uses the active sub-type to determine how to schedule and execute the template. DAG templates orchestrate directed graphs of tasks; Task templates invoke a single executor plugin; Loop templates iterate over a list of items or repeat until a condition is false. Templates are composable — a DAG task can reference a Loop template, which in turn iterates over a DAG template, up to the configured maxNestedDepth.
All template names, task names within DAGs, and parameter names must match the DNS-1123 label rule: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$, maximum 63 characters. Dots are reserved as system namespace separators and are not allowed in user-defined names.

DAG template (template.dag)

A DAG template defines a directed acyclic graph of task invocations. Each task in the graph may declare dependencies on other tasks by name; the engine uses these edges to determine execution order and dispatch all dependency-free tasks in parallel.
string
required
Unique template name within the workflow. Referenced by spec.entrypoint, dag.tasks[].template, and loop.body.
object
Input parameter and artifact declarations for this template. When the DAG is invoked from a parent scope, the caller passes values via arguments.
object
Output declarations for this DAG template. Each output parameter typically uses valueFrom.parameter to pull a value from a completed child task.
string | string[]
Optional subset of task names to treat as the starting nodes. When omitted, all tasks with no dependencies are treated as entrypoints and dispatched immediately. When set, only the named tasks (and their transitive dependents) are run — useful for running a sub-graph of a larger DAG.
Task[]
required
Array of task call-site definitions. Each element describes one node in the graph, not a template definition. Must contain at least one entry.
object
DAG-level continueOn. When set, controls default continue-on behaviour for all tasks in the DAG that do not override it at the task level.
object
Custom phase-derivation expressions for the DAG container itself (not its child tasks). Rarely needed.
string
DAG-level deadline. The whole DAG (and all its child tasks) must complete within this duration, independent of individual task timeouts.

DAG example


Task template (template.task)

A Task template represents a single executor invocation — the leaf node of the execution graph. It carries its own inputs, outputs, and executor declaration, making it a reusable, named unit that DAG tasks can reference by name.
string
required
Unique template name within the workflow.
object
Input parameter and artifact declarations. Values are resolved from the caller’s arguments or from valueFrom references at dispatch time.
object
Output parameter and artifact declarations. Parameters listed here without a value are filled from the executor’s ExecOutputs.Parameters at completion time. Parameters with a value field act as static defaults used when the executor does not produce that key.
object
The executor plugin to invoke for this task.
string
Task deadline as a Go duration string. Requires WithTimeoutWatcher.
object
Retry policy. See the retry fields under DAG task fields.
object
Custom phase expressions. See phaseConditions under DAG task fields.
object
Task-level lifecycle hooks. See hooks under DAG task fields. Both task templates and DAG task call-sites support onSuspend and onResume.
object
Compute resource requirements forwarded via TaskAssignment.Resources.

Task template example


Loop template (template.loop)

A Loop template repeats a body template for each element in a list or until a condition becomes false. It supports static item lists, dynamic item lists sourced from a parameter, and condition-controlled repetition. All three modes run the same body template, which can itself be a DAG, Task, or another Loop.
Exactly one of repeatCondition, items, or itemsFrom must be set. Setting more than one, or none, causes validation to fail.
string
required
Unique template name within the workflow.
object
Input parameter declarations for the loop template.
object
Output declarations for the loop as a whole. Typically used with aggregate to expose collected results from all iterations.
string
Boolean expression evaluated before each iteration. The loop continues as long as the expression evaluates to true. Requires maxIterations to be set as a safety bound. Cannot be combined with items or itemsFrom. Cannot be combined with concurrency (repeat-until loops are serial by definition).
any[]
Static list of items. Each element is passed to the body template as iterator.item for the current iteration. Cannot be combined with repeatCondition or itemsFrom.
string
Expression or parameter reference that resolves to a list at runtime. The resolved list is treated identically to items. Cannot be combined with repeatCondition or items.
integer
Maximum number of iterations to dispatch in parallel. 0 or omitted means unlimited parallelism for items/itemsFrom mode. Not allowed with repeatCondition (repeat-until loops are always serial).
integer
Maximum number of iterations before the loop is forcibly terminated. Required when repeatCondition is set. Optional for items/itemsFrom where the list length already bounds iteration count.
string
required
Name of the template to execute for each iteration. Must reference an existing template in spec.templates.
object
Arguments forwarded to the body template on each iteration. Use "{{iterator.item}}" and "{{iterator.index}}" interpolation to inject per-iteration values.Special interpolation tokens:
  • {{iterator.item}} — the current item from items or itemsFrom
  • {{iterator.index}} — zero-based iteration index
object
Defines how iteration results are combined into the loop’s output parameters. When omitted the last iteration’s outputs are used.
object
Custom phase-derivation expressions for the loop container itself.
string
Loop-level deadline. The entire loop (all iterations) must complete within this duration.

Loop example


Shared sub-types

Retry

Only leaf tasks (executor invocations) support retry. DAG and Loop containers are not retried directly. The engine resets the task to Created and re-dispatches it without writing a terminal phase, keeping RetryCount as the authoritative retry counter.

ContinueOn

When continueOn.failed is true and a task reaches Failed, dependents are still dispatched. This enables best-effort pipelines that must always notify even when upstream steps fail.

PhaseConditions

User-defined expressions that override the engine’s ExecCode → Phase mapping. The engine evaluates them in order (succeeded first) and uses the first one that evaluates to true. If none match, the default mapping applies.

Executor

The type field is the only field of the Executor struct. All configuration needed by the executor is passed via the task’s inputs.parameters.