createWorkflow
createWorkflow():
Workflow
Defined in: core/src/core/workflow.ts:115
Creates a new workflow instance.
This is the primary factory function for creating workflows. Each workflow maintains its own registry of event handlers and can create multiple independent execution contexts.
Returns
Section titled “Returns”A new workflow instance
Example
Section titled “Example”// Create a simple workflowconst workflow = createWorkflow();
// Register handlersworkflow.handle([InputEvent], async (context, event) => \{ const processed = await processInput(event.data); return OutputEvent.with(processed);\});
// Use the workflowconst context = workflow.createContext();const input = InputEvent.with(\{ text: 'Hello World' \});await context.send(input);