Workflow.createRunAsync()
The .createRunAsync()
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.
💡
For the legacy createRun()
method that returns an object with methods, see the Legacy Workflows section.
Usage example
await workflow.createRunAsync();
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.createRunAsync();
const result = await run.start({
inputData: {
value: 10,
},
});