Workflow.createRun()
The .createRun()
method creates a new workflow run instance, allowing you to execute the workflow with specific input data.
Usage
const myWorkflow = createWorkflow({
id: "my-workflow",
inputSchema: z.object({
startValue: z.string(),
}),
outputSchema: z.object({
result: z.string(),
}),
steps: [step1, step2, step3], // Declare steps used in this workflow
})
.then(step1)
.then(step2)
.then(step3)
.commit();
const mastra = new Mastra({
vnext_workflows: {
myWorkflow,
},
});
const run = mastra.vnext_getWorkflow("myWorkflow").createRun();
Parameters
options?:
{ runId?: string }
Optional configuration for the run, including a custom run ID
Returns
run:
Run
A new workflow run instance that can be used to execute the workflow