> Discover all available pages from the documentation index: https://mastra.ai/llms.txt # Mastra.addDynamicWorkflows() > **Beta:** Dynamic workflows are in beta. Breaking changes may occur without a major version bump until the API is stable. The `.addDynamicWorkflows()` method adds a bundle of dynamic workflow definitions that may reference each other. The typical case is a root workflow plus helper workflows it nests, where none of the definitions exist yet. The whole bundle is validated up front. Members are then registered in dependency order, so a helper is always in place before the workflow that nests it. [`addDynamicWorkflow()`](https://mastra.ai/reference/core/addDynamicWorkflow) is the single-member case. ## Usage example ```typescript await mastra.addDynamicWorkflows([ helperDefinition, // nested by the root — order in the array doesn't matter rootDefinition, // graph contains { type: 'workflow', workflowId: helperDefinition.id } ]) ``` ## Parameters **defs** (`readonly DynamicWorkflowGraph[]`): The workflow definitions to add. Nested-workflow references may resolve against the live registries or against other members of the same bundle. ## Returns A promise that resolves once every member is validated, registered, and persisted. ## Behavior - References resolve against the instance's registries union the bundle's own IDs, so a root may nest a helper introduced in the same call. Registration order is derived from the dependency graph, not the array order. - A rejected bundle registers nothing. Duplicate IDs, invalid members, and dependency cycles are detected before anything is mutated, and if registration or persistence fails partway, the in-memory registry is restored to its prior state. - Storage writes happen last. A storage-level failure mid-bundle can leave some rows written, but the registry is still rolled back and the orphaned rows are inert until the next boot. ## Related - [Mastra.addDynamicWorkflow()](https://mastra.ai/reference/core/addDynamicWorkflow): Add a single definition - [Dynamic workflows](https://mastra.ai/docs/workflows/dynamic-workflows): Set up and use dynamic workflows - [Dynamic workflow definition](https://mastra.ai/reference/workflows/dynamic-workflow-definition): Definition fields and graph entries