Configuring Sequences in app.config.yaml

Overview

Sequences in Adobe App Builder allow you to chain multiple actions together, where the output of one action becomes the input of the next. While sequences can be created using CLI commands, they can also be configured declaratively in your app.config.yaml file following the OpenWhisk specification.

data-variant=info
data-slots=text
To get started quickly with a hands-on example, check out the action-sequences QuickStart which provides a ready-to-run sample application.

What are Sequences?

A sequence is a special type of action that executes a series of actions in order. The result of one action is passed as the input to the next action in the sequence. This provides a powerful way to compose actions without writing additional code to handle the chaining logic.

Benefits of Sequences

When to Use Sequences

Sequences are ideal when you need to:

When NOT to use sequences:

Basic Syntax

Sequences are declared in your app.config.yaml file under the sequences section of the runtimeManifest, separate from regular actions.

runtimeManifest:
  packages:
    my-package:
      sequences:
        my-sequence:
          actions: action1, action2, action3

Complete Example

Here's a comprehensive example showing how to configure a sequence along with its component actions:

application:
  actions: actions
  web: web-src
  runtimeManifest:
    packages:
      my-package:
        license: Apache-2.0
        actions:
          # Individual actions that will be part of the sequence
          validate-input:
            function: actions/validate-input/index.js
            runtime: nodejs:20
            inputs:
              LOG_LEVEL: debug
            annotations:
              require-adobe-auth: true
          
          process-data:
            function: actions/process-data/index.js
            runtime: nodejs:20
            inputs:
              LOG_LEVEL: debug
          
          format-output:
            function: actions/format-output/index.js
            runtime: nodejs:20
        
        # The sequence that chains the actions together
        sequences:
          data-pipeline:
            actions: validate-input, process-data, format-output
            web: true
            annotations:
              require-adobe-auth: true

Full Path References

When referencing actions in a sequence, you can use simple names (if in the same package) or full paths:

sequences:
  my-sequence:
    actions: /namespace/package/action1, /namespace/package/action2, action3

Web Actions as Sequences

Sequences can be exposed as web actions just like regular actions:

runtimeManifest:
  packages:
    my-package:
      sequences:
        public-api-sequence:
          actions: authenticate, process-request, format-response
          web: true
          web-export: true

Real-World Example

Here's a practical example of a sequence that processes and deletes resources, based on this internal example:

application:
  actions: actions
  web: web-src
  runtimeManifest:
    packages:
      resource-management:
        license: Apache-2.0
        actions:
          # Component actions
          list-resources:
            function: actions/list-resources/index.js
            runtime: nodejs:20
            inputs:
              LOG_LEVEL: info
          
          validate-deletion:
            function: actions/validate-deletion/index.js
            runtime: nodejs:20
          
          delete-resources:
            function: actions/delete-resources/index.js
            runtime: nodejs:20
          
          send-notification:
            function: actions/send-notification/index.js
            runtime: nodejs:20
        
        # Sequence that orchestrates the deletion workflow
        sequences:
          delete-workflow:
            actions: list-resources, validate-deletion, delete-resources, send-notification
            web: true
            annotations:
              require-adobe-auth: true
              final: true

Important Considerations

Data Flow

Each action in the sequence receives the output of the previous action as its input parameters. Ensure that:

Error Handling

If any action in the sequence fails:

Annotations and Parameters

Sequences can have their own annotations and default parameters:

sequences:
  my-sequence:
    actions: action1, action2
    inputs:
      defaultParam: "value"
    annotations:
      require-adobe-auth: true
      description: "My sequence description"

The same annotations available for regular actions can be applied to sequences, including require-adobe-auth and disable-download.

CLI Commands for Sequences

While this guide focuses on declarative configuration in app.config.yaml, you can also manage sequences using CLI commands. This is useful for testing, one-off tasks, or when you need to create sequences programmatically.

Creating Sequences via CLI

You can create a sequence directly using the aio CLI:

# Create a basic sequence
aio runtime action create my-sequence --sequence action1,action2,action3

# Create a sequence with full paths
aio runtime action create my-sequence --sequence /namespace/pkg/action1,/namespace/pkg/action2

# Create a web-enabled sequence
aio runtime action create my-sequence --sequence action1,action2,action3 --web true

# Create a sequence with annotations
aio runtime action create my-sequence --sequence action1,action2 --annotation require-adobe-auth true

Listing and Getting Sequence Details

# List all actions (including sequences)
aio runtime action list

# Get details about a specific sequence
aio runtime action get my-sequence

# Get the sequence definition in JSON format
aio runtime action get my-sequence --summary

Invoking Sequences

# Invoke a sequence
aio runtime action invoke my-sequence --result

# Invoke with parameters
aio runtime action invoke my-sequence --param key1 value1 --param key2 value2 --result

# Invoke asynchronously (non-blocking)
aio runtime action invoke my-sequence --param key value

# Invoke and get the activation ID
aio runtime action invoke my-sequence --result --blocking

Updating Sequences

# Update an existing sequence
aio runtime action update my-sequence --sequence newaction1,newaction2,newaction3

# Update sequence annotations
aio runtime action update my-sequence --annotation description "Updated description"

Deleting Sequences

# Delete a sequence
aio runtime action delete my-sequence

Testing Sequences

After deploying your application with sequences defined in app.config.yaml, you can test them:

# Deploy your application
aio app deploy

# Invoke the sequence
aio runtime action invoke my-package/my-sequence --result

# With parameters
aio runtime action invoke my-package/my-sequence --param key value --result

# Get activation logs
aio runtime activation list
aio runtime activation get <activation-id>

CLI vs Declarative Configuration

Use CLI commands when:

Use app.config.yaml when:

Migration from CLI to Declarative Configuration

If you previously created sequences using CLI commands, you can migrate them to declarative configuration in app.config.yaml for better maintainability and version control.

Before (CLI approach):

aio runtime action create my-sequence --sequence action1,action2,action3 --web true
aio runtime action update my-sequence --annotation require-adobe-auth true

After (Declarative approach):

runtimeManifest:
  packages:
    my-package:
      sequences:
        my-sequence:
          actions: action1, action2, action3
          web: true
          annotations:
            require-adobe-auth: true

Benefits of migration:

Additional Resources

Next Steps

Learn more about Webpack Configuration or return to the Configuration Overview.