跳到主要内容
非官方简体中文翻译,内容版权归 Mastra 所有,遵循 Apache-2.0 许可。

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
Usage example的直接链接

workflow.dountil(step1, async ({ inputData }) => true)

Parameters
Parameters的直接链接

step:

Step
The step instance to execute in the loop

condition:

((params: ConditionFunctionParams & { iterationCount: number }) => Promise<boolean>) | { predicate: Predicate }
A function that returns a boolean indicating whether to continue the loop. The function receives the execution parameters (excluding setState and suspend) and the iteration count. A declarative { predicate } object is also accepted.

options?:

StepFlowEntryOptions
Optional identity and display metadata for this graph entry. Preserved through serialization and storage; has no effect on execution.
string
string
Record<string, unknown>

Returns
Returns的直接链接

workflow:

Workflow
The workflow instance for method chaining
On this page