Steps

To create a workflow, you define the steps you want and their order of executionusing the Workflows syntax. Every workflow must have at least one step.

By default, Workflows treats steps as if they are in an orderedlist and executes them one at a time until all the steps have run. For example,this workflow has two steps:

YAML

-STEP_NAME_A:...-STEP_NAME_B:...

JSON

[{"STEP_NAME_A":{...}},{"STEP_NAME_B":{...}},]

Step names

Step names must be unique at thesubworkflow level. For example,in the following workflow, a step namedinit is allowed in both themainblock and the subworkflow.

YAML

main:params:[input]steps:-init:call:subsub:steps:-init:assign:-a:0

JSON

{"main":{"params":["input"],"steps":[{"init":{"call":"sub"}}]},"sub":{"steps":[{"init":{"assign":[{"a":0}]}}]}}

Workflows doesn't enforce a naming convention for step names.However, we recommend consistent usage such as creating step names that onlyinclude alphanumeric characters and underscores.

Step types

Workflows supports various types of steps, including the following:

Implicit step ordering

This sample shows implicit step ordering within a workflow. By default, thesteps of a workflow are executed in the order they appear in the workflowdefinition.

YAML

-first_step:call:http.getargs:url:https://www.example.com/callA-second_step:call:http.getargs:url:https://www.example.com/callB-third_step:call:http.getargs:url:https://www.example.com/callC

JSON

[{"first_step":{"call":"http.get","args":{"url":"https://www.example.com/callA"}}},{"second_step":{"call":"http.get","args":{"url":"https://www.example.com/callB"}}},{"third_step":{"call":"http.get","args":{"url":"https://www.example.com/callC"}}}]

Nested steps

You can use asteps block to nest a series of steps and further define aworkflow:

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:...}]}}]}}

Variables declared in asteps block have workflow-level scope and can beaccessed outside of the block. Any step type can be nested inside of astepsblock includingassign,call, andswitch. For example:

YAML

main:steps:-series_one:steps:-step_a:call:http.getargs:url:https://host.com/api1result:api_response1-step_b:assign:-varA:"Monday"-varB:"Tuesday"-series_two:steps:-step_c:call:http.getargs:url:https://host.com/api2result:api_response2-step_d:assign:-varC:"Wednesday"-varD:"Thursday"

JSON

{"main":{"steps":[{"series_one":{"steps":[{"step_a":{"call":"http.get","args":{"url":"https://host.com/api1"},"result":"api_response1"}},{"step_b":{"assign":[{"varA":"Monday"},{"varB":"Tuesday"}]}}]}},{"series_two":{"steps":[{"step_c":{"call":"http.get","args":{"url":"https://host.com/api2"},"result":"api_response2"}},{"step_d":{"assign":[{"varC":"Wednesday"},{"varD":"Thursday"}]}}]}}]}}

Note that in some cases,steps is required; for example, when defining asubworkflow or afor loop.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.