UNPKG

@mastra/core

Version:

Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.

25 lines (14 loc) 858 B
# 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 **step** (`Step`): The step instance to execute in the loop **condition** (`(params : ExecuteParams & { iterationCount: number }) => Promise<boolean>`): A function that returns a boolean indicating whether to continue the loop. The function receives the execution parameters and the iteration count. ## Returns **workflow** (`Workflow`): The workflow instance for method chaining ## Related - [Control Flow](https://mastra.ai/docs/workflows/control-flow) - [ExecuteParams](https://mastra.ai/reference/workflows/step)