> Discover all available pages from the documentation index: https://mastra.zisheng.pro/llms.txt # Workflow\.sleep() `.sleep()` 方法暂停执行指定的毫秒数。它接受静态数字或回调函数,以定义运行时延迟。 ## 使用示例 ```typescript workflow.sleep(5000) ``` ## 参数 **milliseconds** (`number | ((context: { inputData: any }) => number | Promise)`): 要暂停执行的毫秒数,或返回延迟时间的回调 ## 返回值 **workflow** (`Workflow`): 用于方法链式调用的 workflow 实例 ## 扩展示例 ```typescript import { createWorkflow, createStep } from "@mastra/core/workflows"; const step1 = createStep({...}); const step2 = createStep({...}); export const testWorkflow = createWorkflow({...}) .then(step1) .sleep(async ({ inputData }) => { const { delayInMs } = inputData; return delayInMs; }) .then(step2) .commit(); ```