Skip to main content

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.

note

For the legacy createRun() method that returns an object with methods, see the Legacy Workflows section.

Usage exampleDirect link to Usage example

await workflow.createRunAsync();

ParametersDirect link to Parameters

runId?:

string
Optional custom identifier for the workflow run

ReturnsDirect link to Returns

run:

Run
A new workflow run instance that can be used to execute the workflow

Extended usage exampleDirect link to Extended usage example

const workflow = mastra.getWorkflow("workflow");

const run = await workflow.createRunAsync();

const result = await run.start({
inputData: {
value: 10,
},
});

On this page