Skip to main content
Pass a Workflow as a step inside another Workflow. The inner workflow runs as a single step in the outer workflow, with output chained to the next step.

Basic Example

nested_workflow.py
The outer workflow runs inner_workflow as its first step. The inner workflow’s output flows into the writing_phase step.

How It Works

  1. The outer workflow reaches a step with workflow=inner_workflow
  2. The inner workflow’s .run() executes with the prepared input (chained from the previous step)
  3. Session state is deep-copied into the inner workflow and merged back after execution
  4. The inner workflow’s output is converted to a StepOutput with step_type=StepType.WORKFLOW
  5. Execution continues to the next step in the outer workflow

Two Ways to Declare

auto_wrap.py

Inner workflows and primitives

An inner workflow can use the same primitives and combinations as any top-level workflow in Agno: agents, executors, nested Steps, Condition, Loop, Router, and Parallel, mixed however your pipeline needs. The basic example uses agent and executor steps inside the inner workflow. Deep nesting shows multiple levels with Parallel and sub-workflows.

Deep Nesting

Workflows can be nested multiple levels deep. Each level runs its own sub-workflows independently.
deeply_nested.py

Streaming Events

When streaming, inner workflow events bubble up with a nested_depth field. Use this to distinguish inner vs. outer events.
event_inspection.py

Developer Resources

Reference

For complete API documentation, see Step Reference.