> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.moveworks.com/agent-studio/actions/compound-actions/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.moveworks.com/_mcp/server.
# Compound Actions
**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
e.g., Data Mapping from User/Context]
B --> C[Core Actions
e.g., HTTP Calls, Scripts]
C --> D{Control Flow?}
D -->|Switch: Condition Check| E[Branch 1
e.g., Admin Path]
D -->|Switch: Condition Check| F[Branch 2
e.g., User Path]
E --> G[Actions/Next Steps]
F --> G
G --> H[Parallel: Split Independent Tasks]
H --> I[Task 1
e.g., Fetch Data]
H --> J[Task 2
e.g., Notify User]
I --> K[Merge Outputs]
J --> K
K --> L[Outputs
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 vice versa.

> **Comments**
>
> *YAML comments (`#`) are supported and preserved during edits, but switching between low-code and code views will strip them.*
> **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)
## Docs
- [Action](https://docs.moveworks.com/agent-studio/actions/compound-actions/action.md)
- [Switch](https://docs.moveworks.com/agent-studio/actions/compound-actions/switch.md)
- [For Loop](https://docs.moveworks.com/agent-studio/actions/compound-actions/for.md)
- [Parallel](https://docs.moveworks.com/agent-studio/actions/compound-actions/parallel.md)
- [Return](https://docs.moveworks.com/agent-studio/actions/compound-actions/return.md)
- [Try Catch and Raise Error](https://docs.moveworks.com/agent-studio/actions/compound-actions/try-catch-and-raise-error.md): Learn how to use Try Catch and Raise Error expressions for graceful error handling in Moveworks compound actions. Handle API failures and create custom error responses.
- [Notify](https://docs.moveworks.com/agent-studio/actions/compound-actions/notify.md)
- [Input Arguments](https://docs.moveworks.com/agent-studio/actions/compound-actions/compound-action-input-arguments.md):
- [Progress Updates](https://docs.moveworks.com/agent-studio/actions/compound-actions/progress-updates.md)
- [Compound Action Patterns](https://docs.moveworks.com/agent-studio/actions/compound-actions/compound-action-patterns.md)
- [Compound Action Data Bank](https://docs.moveworks.com/agent-studio/actions/compound-actions/compound-action-exposed-data.md):
- [Compound Action Examples](https://docs.moveworks.com/agent-studio/actions/compound-actions/compound-action-examples.md):
- [Troubleshooting Compound Actions](https://docs.moveworks.com/agent-studio/actions/compound-actions/troubleshooting-compound-actions.md):