Workflow.createRun()
The .createRun() method creates a new workflow run instance, allowing you to execute the workflow with specific input data. This is the current API that returns a Run instance.
Usage example
await workflow.createRun();
Parameters
runId?:
string
Optional custom identifier for the workflow run
Returns
run:
Run
A new workflow run instance that can be used to execute the workflow
Extended usage example
const workflow = mastra.getWorkflow("workflow");
const run = await workflow.createRun();
const result = await run.start({
inputData: {
value: 10,
},
});