You can search the Workflows syntax for its reserved words and other details. To see examples of the syntax in action, see the cheat sheet.
Reserved word (and example) |
Description | Use with | See also | Details |
---|---|---|---|---|
|
Pass arguments and their values when calling a function that accepts parameters. | call steps
|
call result |
|
|
Set the value of a variable. | — | — | |
|
Execute parallel branches concurrently and the steps in each branch sequentially. |
steps
|
parallel |
|
|
Terminate iteration of a for loop.
|
next in for loops
|
continue |
|
|
Run a function and return a result. | — | args result |
|
|
Provide an expression to control if a step is executed (the first condition to evaluate as true). | switch
|
— | |
|
Terminate the current iteration of a for loop and
continue with the next iteration.
|
next in for loops
|
break |
|
|
Stop a workflow's execution without returning a value. | next
|
— | |
|
Catch and handle errors thrown during a workflow execution. |
try
|
retry |
|
|
Iterate over a sequence of numbers or through a collection of data, such as a list or map. | steps |
— | |
|
Define your main workflow. If a workflow
has a subworkflow, or to receive runtime arguments, there must be a
main block. |
Subworkflows | — | |
|
Define what step Workflows should execute next. | — | break continue |
|
|
Execute two or more steps concurrently. |
branches
for loops
steps
|
— | |
|
Accept workflow execution arguments, or arguments passed to a subworkflow. | Subworkflows | main |
|
|
Raise custom errors. | — |
except retry try
|
|
|
Assign the result from a call to this variable. | call steps
|
args |
|
|
Define the retry behavior and the number of retry attempts. | try
|
— | |
|
Stop a workflow's execution and return a value or expression. | — | — | |
|
Nest a series of steps. |
branches for loopsSubworkflows try
|
main |
|
|
Allow the value of an expression to control the flow of a workflow's execution. | — | condition |
|
|
Define a list of steps to retry if an error is raised, or catch and handle the error. | — | except retry
|
Example:
args
YAML
- STEP_NAME: call: ... args: ... result: VARIABLE
JSON
[ { "STEP_NAME": { "call": ..., "args": { ... }, "result": "VARIABLE" } } ]
Example: assign
YAML
- STEP_NAME: assign: - VARIABLE_NAME: VALUE
JSON
[ { "STEP_NAME": { "assign": [ { "VARIABLE_NAME": "VALUE" } ] } } ]
Example: branches
YAML
- PARALLEL_STEP_NAME: parallel: ... branches: - BRANCH_NAME_A: steps: ... - BRANCH_NAME_B: steps: ...
JSON
[ { "PARALLEL_STEP_NAME": { "parallel": { ... "branches": [ { "BRANCH_NAME_A": { "steps": ... } }, { "BRANCH_NAME_B": { "steps": ... } } ] } } } ]
Example: break
YAML
- FOR_LOOP_STEP_NAME_A: for: value: LOOP_VARIABLE_NAME_A in: ${LIST_EXPRESSION_A} # or simply in: LIST_DEFINITION steps: - STEP_NAME_A: next: continue - FOR_LOOP_STEP_NAME_B: for: value: LOOP_VARIABLE_NAME_B range: [${BEGIN_EXPRESSION}, ${END_EXPRESSION}] steps: - STEP_NAME_B: next: break
JSON
[ { "FOR_LOOP_STEP_NAME_A": { "for": { "value": "LOOP_VARIABLE_NAME_A", "in": "${LIST_EXPRESSION_A}", "steps": [ { "STEP_NAME_A": { "next": "continue" } } ] } } }, { "FOR_LOOP_STEP_NAME_B": { "for": { "value": "LOOP_VARIABLE_NAME_B", "range": [ "${BEGIN_EXPRESSION}", "${END_EXPRESSION}" ], "steps": [ { "STEP_NAME_B": { "next": "break" } } ] } } } ]
Example: call
YAML
- STEP_NAME: call: ... args: ... result: VARIABLE
JSON
[ { "STEP_NAME": { "call": ..., "args": { ... }, "result": "VARIABLE" } } ]
Example: condition
YAML
- STEP_NAME_A: switch: - condition: ${EXPRESSION_A} next: STEP_NAME_B - condition: ${EXPRESSION_B} next: STEP_NAME_C - condition: true next: STEP_NAME_C next: STEP_NAME_D
JSON
[ { "STEP_NAME_A": { "switch": [ { "condition": "${EXPRESSION_A}", "next": "STEP_NAME_B" }, { "condition": "${EXPRESSION_B}", "next": "STEP_NAME_C" } { "condition": true, "next": "STEP_NAME_C" } ], "next": "STEP_NAME_D" } } ]
Example: continue
YAML
- FOR_LOOP_STEP_NAME_A: for: value: LOOP_VARIABLE_NAME_A in: ${LIST_EXPRESSION_A} # or simply in: LIST_DEFINITION steps: - STEP_NAME_A: next: continue - FOR_LOOP_STEP_NAME_B: for: value: LOOP_VARIABLE_NAME_B range: [${BEGIN_EXPRESSION}, ${END_EXPRESSION}] steps: - STEP_NAME_B: next: break
JSON
[ { "FOR_LOOP_STEP_NAME_A": { "for": { "value": "LOOP_VARIABLE_NAME_A", "in": "${LIST_EXPRESSION_A}", "steps": [ { "STEP_NAME_A": { "next": "continue" } } ] } } }, { "FOR_LOOP_STEP_NAME_B": { "for": { "value": "LOOP_VARIABLE_NAME_B", "range": [ "${BEGIN_EXPRESSION}", "${END_EXPRESSION}" ], "steps": [ { "STEP_NAME_B": { "next": "break" } } ] } } } ]
Example: end
YAML
- STEP_NAME: ... next: end
JSON
[ { "STEP_NAME": { ... "next": "end" } } ]
Example: except
YAML
- STEP_NAME: try: call: http.get ... except: as: ERROR_MAP steps: ...
JSON
[ { "STEP_NAME": { "try": { "call": "http.get" ... }, "except": { "as": "ERROR_MAP", "steps": ... } } } ]
Example: for
YAML
- FOR_LOOP_STEP_NAME: for: value: LOOP_VARIABLE_NAME index: INDEX_VARIABLE_NAME in: ${LIST_EXPRESSION} steps: - STEP_NAME_A: ...
JSON
[ { "FOR_LOOP_STEP_NAME": { "for": { "value": "LOOP_VARIABLE_NAME", "index": "INDEX_VARIABLE_NAME", "in": "${LIST_EXPRESSION}", "steps": [ { "STEP_NAME_A": ... } ] } } } ]
Example: main
YAML
main: params: [MAP_NAME] steps: - STEP_NAME: ... ...
JSON
{ "main": { "params": [ "MAP_NAME" ], "steps": [ { "STEP_NAME": { ... } }, ... ] } }
Example: next
YAML
- STEP_NAME: ... next: STEP_NAME_TO_JUMP_TO
JSON
[ { "STEP_NAME": { ... "next": "STEP_NAME_TO_JUMP_TO" } } ]
Example: params
YAML
main: steps: - STEP_NAME: call: SUBWORKFLOW_NAME args: ARG_1: VALUE_1 ARG_2: VALUE_2 ... result: OUTPUT_VARIABLE SUBWORKFLOW_NAME: params: [PARAMETER_1,PARAMETER_2...] steps: - step_1: ...
JSON
{ "main": { "steps": [ { "STEP_NAME": { "call": "SUBWORKFLOW_NAME", "args": { "ARG_1": "VALUE_1", "ARG_2": "VALUE_2" }, "result": "OUTPUT_VARIABLE" } } ] }, "SUBWORKFLOW_NAME": { "params": ["PARAMETER_1,PARAMETER_2"...], "steps": [ { "step_1": ... } ] } }
Example: parallel
YAML
- PARALLEL_STEP_NAME: parallel: exception_policy: POLICY shared: [VARIABLE_A, VARIABLE_B, ...] BRANCHES_OR_FOR: ...
JSON
[ { "PARALLEL_STEP_NAME": { "parallel": { "exception_policy": "POLICY", "shared": [ "VARIABLE_A", "VARIABLE_B", ... ], "BRANCHES_OR_FOR": ... } } } ]
Example: raise
YAML
- step_a: raise: "Something went wrong."
JSON
[ { "step_a": { "raise": "Something went wrong." } } ]
Example: result
YAML
- STEP_NAME: call: ... args: ... result: VARIABLE
JSON
[ { "STEP_NAME": { "call": ..., "args": ..., "result": "VARIABLE" } } ]
Example: retry
YAML
- step_name: try: steps: ... retry: RETRY_POLICY predicate: RETRY_PREDICATE max_retries: NUMBER_OF_RETRIES backoff: initial_delay: DELAY_SECONDS max_delay: MAX_DELAY_SECONDS multiplier: DELAY_MULTIPLIER
JSON
[ { "step_name": { "try": { "steps": [ ... ] }, "retry": "RETRY_POLICY" "predicate": "RETRY_PREDICATE", "max_retries": NUMBER_OF_RETRIES, "backoff": { "initial_delay": DELAY_SECONDS, "max_delay": MAX_DELAY_SECONDS, "multiplier": DELAY_MULTIPLIER } } } ]
Example: return
YAML
- STEP_NAME: ... return: ${VARIABLE}
JSON
[ { "STEP_NAME": { ... "return": "${VARIABLE}" } } ]
Example: steps
YAML
- STEP_NAME: steps: - STEP_NAME_1: steps: - STEP_NAME_A: ... - STEP_NAME_B: ... - STEP_NAME_2: steps: - STEP_NAME_C: ...
JSON
{ STEP_NAME: { "steps": [ { STEP_NAME_1: { "steps": [ { STEP_NAME_A: ... }, { STEP_NAME_B: ... } ] } }, { STEP_NAME_2: { "steps": [ { STEP_NAME_C: ... } ] } } ] } }
Example: switch
YAML
- STEP_NAME_A: switch: - condition: ${EXPRESSION_A} next: STEP_NAME_B - condition: ${EXPRESSION_B} next: STEP_NAME_C - condition: true next: STEP_NAME_C next: STEP_NAME_D
JSON
[ { "STEP_NAME_A": { "switch": [ { "condition": "${EXPRESSION_A}", "next": "STEP_NAME_B" }, { "condition": "${EXPRESSION_B}", "next": "STEP_NAME_C" } { "condition": true, "next": "STEP_NAME_C" } ], "next": "STEP_NAME_D" } } ]
Example: try
YAML
- STEP_NAME: try: call: http.get ... except: as: ERROR_MAP steps: ...
JSON
[ { "STEP_NAME": { "try": { "call": "http.get" ... }, "except": { "as": "ERROR_MAP", "steps": ... } } } ]