Run.resume()
The .resume()
method resumes a suspended workflow run with new data, allowing you to continue execution from a specific step.
Usage example
const run = await workflow.createRunAsync();
const result = await run.start({ inputData: { value: "initial data" } });
if (result.status === "suspended") {
const resumedResults = await run.resume({
resumeData: { value: "resume data" }
});
}
Parameters
resumeData?:
z.infer<TResumeSchema>
Data for resuming the suspended step
step?:
Step<string, any, any, TResumeSchema, any, TEngineType> | [...Step<string, any, any, any, any, TEngineType>[], Step<string, any, any, TResumeSchema, any, TEngineType>] | string | string[]
The step(s) to resume execution from. Can be a Step instance, array of Steps, step ID string, or array of step ID strings
runtimeContext?:
RuntimeContext
Runtime context data to use when resuming
runCount?:
number
Optional run count for nested workflow execution
Returns
result:
Promise<WorkflowResult<TOutput, TSteps>>
A promise that resolves to the workflow execution result containing step outputs and status
Extended usage example
if (result.status === "suspended") {
const resumedResults = await run.resume({
step: result.suspended[0],
resumeData: { value: "resume data" }
});
}
Note: When exactly one step is suspended, you can omit the
step
parameter and the workflow will automatically resume that step. For workflows with multiple suspended steps, you must explicitly specify which step to resume.