--- title: "Reference: Workflow.dountil() | Workflows" description: "The .dountil() method executes a step until a condition is met. It always runs the step at least once before evaluating the condition." packages: - "@mastra/core" --- # Workflow\.dountil() The `.dountil()` method executes a step until a condition is met. It always runs the step at least once before evaluating the condition. The first time the condition is evaluated, `iterationCount` is `1`. ## Usage example ```typescript workflow.dountil(step1, async ({ inputData }) => true) ``` ## Parameters Promise) | { predicate: Predicate }', description: 'A function that returns a boolean indicating whether the loop is done. When it returns true the loop ends; when it returns false the step runs again. The function receives the execution parameters (excluding setState, updateState, and suspend) and the iteration count. A declarative { predicate } object is also accepted.', isOptional: false, }, { name: 'options', type: 'StepFlowEntryOptions', description: 'Optional identity and display metadata for this graph entry. Preserved through serialization and storage; has no effect on execution.', isOptional: true, properties: [ { name: 'id', type: 'string', description: 'Stable entry id that editors and tools can use to address this entry across edits', isOptional: true, }, { name: 'description', type: 'string', description: 'Human-readable description of this control-flow operation', isOptional: true, }, { name: 'metadata', type: 'Record', description: 'JSON-serializable metadata, for example a display title for visual editors', isOptional: true, }, ], }, ]} /> ## Returns ## Related - [Control Flow](/docs/workflows/control-flow) - [ExecuteParams](../step#constructor-parameters)