Skip to main content
The Execute Workflow task lets you run another workflow (called a sub-workflow) inside your main workflow. Use it to break complex automations into smaller, reusable pieces that are easier to build, test, and maintain.

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:
RequirementWhy
Must be activatedOnly active workflows can be called as sub-workflows
Same workspaceThe sub-workflow must be in the same workspace as the parent
No human tasksSub-workflows can’t contain Human Review, Human Decision Agent, or Opus Human Task—they run automatically without waiting for people
Has inputs and outputs definedThe 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.
Need human reviews, tasks, or decisions? Put them in the parent workflow, not the sub-workflow. Let the sub-workflow do its processing, then review the outputs after it finishes.
Avoid loops: Make sure the sub-workflow doesn’t call back to the parent workflow (directly or through other workflows). This creates an infinite loop that will never finish.Opus has built-in guardrails to detect and prevent this.
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

Each sub-workflow should do one thing well:
  • Easier to test and debug
  • More reusable across different workflows
  • Simpler to understand and maintain
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
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
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