resume

The resume function continues execution of a suspended workflow step, optionally providing new context data that will be merged with existing step results.

Usage

await workflow.resume({
  runId: "abc-123",
  stepId: "stepTwo", 
  context: {
    secondValue: 100
  }
});

Parameters

config:

object
Configuration for resuming the workflow

config

runId:

string
Unique identifier of the workflow run to resume

stepId:

string
ID of the suspended step to resume

context?:

Record<string, any>
New context data to merge with existing step results

Returns

Promise<WorkflowResult>:

object
Result of the resumed workflow execution

Error Handling

The resume function may throw several types of errors:

try {
  await workflow.resume({
    runId,
    stepId: "stepTwo",
    context: newData
  });
} catch (error) {
  if (error.message === "No snapshot found for workflow run") {
    // Handle missing workflow state
  }
  if (error.message === "Failed to parse workflow snapshot") {
    // Handle corrupted workflow state
  }
}

MIT 2025 © Nextra.