Workflow.watch()
The .watch()
method allows you to monitor the execution of a workflow run, providing real-time updates on the status of steps.
Usage
const run = myWorkflow.createRun();
// Add a watcher to monitor execution
run.watch(event => {
console.log('Step completed:', event.payload.currentStep.id);
});
// Start the workflow
const result = await run.start({ inputData: {...} });
Parameters
cb:
(event: WatchEvent) => void
A callback function that is called whenever a step is completed or the workflow state changes
Returns
unwatch:
() => void
A function that can be called to stop watching the workflow run