# Compose complex pipelines with nested workflows as workflow steps

> A Workflow can now be used directly as a step inside another workflow, enabling modular composition of reusable sub-pipelines.

- Published: 2026-04-09
- Author: Agno Team
- Category: Changelog
- Canonical: https://agno-com-nine.vercel.app/articles/compose-complex-pipelines-with-nested-workflows-as-workflow-steps
- Markdown: https://agno-com-nine.vercel.app/articles/compose-complex-pipelines-with-nested-workflows-as-workflow-steps.md

A `Workflow` can now be used directly as a step inside another workflow, enabling modular composition of reusable sub-pipelines. The inner workflow runs as a single step in the outer workflow, with its output chained to the next step via the standard `StepInput`/`StepOutput` interface. Complex orchestrations can be broken into smaller, independently testable units and assembled without duplicating logic — the same sub-workflow can be reused across multiple parent workflows.

Details:

- Pass a `Workflow` instance to a `Step` via `Step(name="...", workflow=inner_workflow)`, or use the shorthand auto-wrap by placing the workflow directly in the `steps` list (uses the workflow's `name` as the step name)
- Inner workflows support the full set of primitives — `Condition`, `Loop`, `Router`, `Parallel`, agents, and custom executors — mixed in any combination
- Session state is deep-copied into the inner workflow before execution and merged back into the outer workflow after, keeping state consistent across levels
- Workflows can be nested multiple levels deep; streaming events bubble up with a `nested_depth` field so outer and inner events can be distinguished by depth, `workflow_id`, and `workflow_name`
- Enables modular workflow design: build reusable research, processing, or review sub-pipelines once and compose them into larger orchestrations

See the [Nested Workflow docs](https://docs.agno.com/workflows/workflow-patterns/nested-workflow) to learn more.
