Key Capabilities
Reusable Pieces
Build once, use in multiple workflows.
Pass Data In and Out
Send data to the sub-workflow and get results back.
Isolated Execution
Sub-workflows run on their own, making them easier to test and debug.
Better Organization
Keep complex workflows manageable by splitting them into parts.
When to Use It
Use Execute Workflow when you want to:- Reuse the same logic across multiple workflows
- Break a complex workflow into smaller, manageable pieces
- Let different team members work on different parts
- Test pieces of your automation independently
Execute Workflow is for running a separate workflow inside your workflow. For simple yes/no routing within a single workflow, use Decision Agent instead.
Requirements
Before you can use a workflow as a sub-workflow, it must meet these requirements:| Requirement | Why |
|---|---|
| Must be activated | Only active workflows can be called as sub-workflows |
| Same workspace | The sub-workflow must be in the same workspace as the parent |
| No human tasks | Sub-workflows can’t contain Human Review, Human Decision Agent, or Opus Human Task—they run automatically without waiting for people |
| Has inputs and outputs defined | The sub-workflow needs Workflow Input and Workflow Output tasks so data can flow in and out |
How to Add Execute Workflow
1
Create your sub-workflow first
Build the workflow you want to reuse:
- Add a Workflow Input task with the data it needs
- Add your processing logic
- Add a Workflow Output task with the results to return
- Make sure there are no human tasks
2
Activate the sub-workflow
Test it thoroughly in preview mode, then activate it. Sub-workflows must be active before they can be called.
3
Add Execute Workflow to your parent workflow
Drag an Execute Workflow task into your main workflow where you need to call the sub-workflow.
4
Select the sub-workflow
Choose the sub-workflow from the dropdown. Only active workflows in the same workspace that don’t contain human tasks (Human Review, Human Decision Agent, or Opus Human Task) will appear.
5
Map the inputs
The sub-workflow’s inputs are automatically shown. Connect variables from your parent workflow to each input.
The inputs and outputs come from the sub-workflow itself. To change them, edit the sub-workflow directly.
6
Use the outputs
The sub-workflow’s outputs become available in your parent workflow. Connect them to later tasks.
7
Test it
Run a preview to make sure data flows correctly between the parent and sub-workflow.
Tips for Better Results
Keep sub-workflows focused
Keep sub-workflows focused
Each sub-workflow should do one thing well:
- Easier to test and debug
- More reusable across different workflows
- Simpler to understand and maintain
Test sub-workflows on their own first
Test sub-workflows on their own first
Before using a sub-workflow in a parent:
- Run it with test data in preview mode
- Check that outputs are correct
- Make sure it handles edge cases
Don't nest too deep
Don't nest too deep
Avoid sub-workflows that call sub-workflows that call sub-workflows:
- Hard to debug when something goes wrong
- Increases total run time
- Keep it to 2-3 levels maximum
Handle errors gracefully
Handle errors gracefully
Design sub-workflows to return useful information when things go wrong:
- Include a status output (success/failure)
- Return error details so the parent can decide what to do