Workflow API
The Workflow API provides the building blocks to create, configure, and connect steps in a workflow.
Classes
Workflow
The main class used to construct and manage a workflow.
Methods:
-
addStep(step: Step): thisAdds a single step to the workflow.workflow.addStep(myStep); -
addSteps(...steps: Step[]): thisAdds multiple steps to the workflow at once.workflow.addSteps(step1, step2, step3); -
listSteps(): Step[]Returns an array of all steps currently in the workflow.const steps = workflow.listSteps(); -
toJSON(): SerializedWorkflowExports the workflow to a serialized JSON format.const definition = workflow.toJSON(); -
toRuntimeWorkflow(): WorkflowRuntimeShapeConverts the workflow into a shape ready for the runtime engine. Throws if a connection points at a step that isn't in the workflow.const runtimeShape = workflow.toRuntimeWorkflow();
Deploying:
Workflowhas nosave()or deploy method. Workflows are deployed with theculviiCLI — export yourWorkflowfrom a.culvii.tsfile (or one listed underentrypoints:inculvii.yaml) and runculvii deploy --env <sandbox|prod> --workspace <slug>. See Executing Workflows.
The constructor also reads its config:
new Workflow(config: WorkflowConfig)Constructs a workflow.config.idandconfig.nameare required; any steps inconfig.stepsare added immediately.
Step
Represents a single node or action within a workflow.
Methods:
connectTo(targetStep: Step, options?: ConnectStepOptions): thisConnects this step to another step, defining the execution path.triggerStep.connectTo(actionStep);
Types & Interfaces
WorkflowConfig
Configuration object for a complete workflow. id and name are required; active (defaults to true) and steps are optional.
const workflowConfig: WorkflowConfig = {
id: 'status-workflow', // required — stable slug used by the platform
name: 'Status Workflow',
active: true,
steps: [trigger, setStatus],
};
WorkflowStepConfig
Configuration object for an individual step.
const stepConfig: WorkflowStepConfig = {
name: 'Set Status',
type: 'core.set',
params: {
values: {
status: 'ready',
},
},
};
ConnectStepOptions
Options for connecting steps, such as conditional branching.
SerializedWorkflow
The JSON representation of a workflow.
WorkflowRuntimeShape
The internal representation used by the execution engine.