start
The start function begins execution of a workflow run. It processes all steps in the defined workflow order, handling parallel execution, branching logic, and step dependencies.
Usage
const { runId, start } = workflow.createRun();
const result = await start({
triggerData: { inputValue: 42 }
});
Parameters
config?:
object
Configuration for starting the workflow run
config
triggerData:
Record<string, any>
Initial data that matches the workflow's triggerSchema
Returns
results:
Record<string, any>
Combined output from all completed workflow steps
status:
'completed' | 'error' | 'suspended'
Final status of the workflow run
Error Handling
The start function may throw several types of validation errors:
try {
const result = await start({ triggerData: data });
} catch (error) {
if (error instanceof ValidationError) {
console.log(error.type); // 'circular_dependency' | 'no_terminal_path' | 'unreachable_step'
console.log(error.details);
}
}
Related
- Example: Creating a Workflow
- Example: Suspend and Resume
- createRun Reference
- Workflow Class Reference
- Step Class Reference