***

title: Compound Actions
position: 4
deprecated: false
hidden: false
---------------------

For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://help.moveworks.com/agent-studio/actions/llms.txt. For full documentation content, see https://help.moveworks.com/agent-studio/actions/llms-full.txt.

**Compound Actions** empower developers to build sophisticated, multi-step automations within Agent Studio, chaining actions, data transformations, and logic into reusable AI workflows.

Think of Compound Actions as an orchestration layer that can:

* [Collect input arguments](/agent-studio/actions/compound-actions/compound-action-input-arguments/) from data sources
* [Execute actions](/agent-studio/actions/compound-actions/action/) to complete tasks
* [Conditionally run](/agent-studio/actions/compound-actions/switch/) different branches of logic
* [Loop over items](/agent-studio/actions/compound-actions/for/) and run steps for each item
* [Run steps at the same time](/agent-studio/actions/compound-actions/parallel/)
* [Return information](/agent-studio/actions/compound-actions/return/) to the user or processes
* [Handle error gracefully](/agent-studio/actions/compound-actions/try-catch-and-raise-error/)
* [Notify users](/agent-studio/actions/compound-actions/notify/) with interactive messages and buttons

## Why Use Compound Actions

* **Modularity**: Break down monolithic agents into testable, composable steps.
* **Efficiency**: Parallelize tasks or loop over lists to cut execution time.
* **Resilience**: Built-in error handling and early exits keep workflows robust.
* **Interactivity**: Notify users mid-flow with buttons for seamless handoffs.

```mermaid
flowchart TD
    A[Start: User Query or Trigger] --> B[Inputs<br />e.g., Data Mapping from User/Context]
    B --> C[Core Actions<br />e.g., HTTP Calls, Scripts]
    C --> D{Control Flow?}
    D -->|Switch: Condition Check| E[Branch 1<br />e.g., Admin Path]
    D -->|Switch: Condition Check| F[Branch 2<br />e.g., User Path]
    E --> G[Actions/Next Steps]
    F --> G
    G --> H[Parallel: Split Independent Tasks]
    H --> I[Task 1<br />e.g., Fetch Data]
    H --> J[Task 2<br />e.g., Notify User]
    I --> K[Merge Outputs]
    J --> K
    K --> L[Outputs<br />e.g., Return Mapped Data]
    L --> M[End: Chat Response or Handoff]
    style A fill:#e1f5fe
    style M fill:#e8f5e8
    style D shape: diamond
    style H shape: diamond
```

## The `steps` Key

The `steps` key defines a sequence of expressions executed in order, forming the backbone of multi-step Compound Actions. It groups logic cleanly, ensuring predictable flow while enabling nesting for controls like `switch` or `parallel`. Use it whenever chaining more than one expression, it's required for compound structures to maintain order and scope.

```yaml
steps:
  - action:
      action_name: fetch_user_data
      output_key: user_info
      input_args:
        user_id: data.requestor_id
  - switch:  # Nested control
      cases:
        - condition: user_info.role == "admin"
          steps:
            - return:
                output_mapper:
                  access: '''granted'''
```

## Getting Started

1. **Prerequisites**: Familiarity with Moveworks [Data Mappers](/agent-studio/core-platform/configuration-languages/moveworks-bender-language-reference) and [DSL](/agent-studio/core-platform/configuration-languages/moveworks-dsl-reference)
2. **Use the Low Code Editor**: Get started fast with the low code editor. Switching back to code mode will generate the compound action script for you and viceversa.

   ![](https://files.readme.io/628774ff2d8ff2ac4e2661f13aa0be592d6541b622436a30658a62ae82095243-CleanShot_2025-09-17_at_11.33.49.png)

<Callout intent="info" title="Comments">
  *YAML comments (`#`) are supported and preserved during edits, but switching between low-code and code views will strip them.*
</Callout>

<Callout intent="info">
  **See it in action:** [Quickstart #5: Webhook Ambient Agent](/agent-studio/quickstart-guide/webhook-triggers-quickstart-guide) · [Quickstart #6: Expense Approval](/agent-studio/quickstart-guide/quickstart-6-expense-approval-ambient-agent)
</Callout>