# Workflow.commit()
[EN] Source: https://mastra.ai/reference/legacyWorkflows/commit

The `.commit()` method re-initializes the workflow's state machine with the current step configuration.

## Usage

```typescript
workflow.step(stepA).then(stepB).commit();
```

## Returns

<PropertiesTable
  content={[
    {
      name: "workflow",
      type: "LegacyWorkflow",
      description: "The workflow instance",
    },
  ]}
/>

## Related

- [Branching Paths example](/examples/workflows_legacy/branching-paths)
- [Workflow Class Reference](./workflow)
- [Step Reference](./step-class)
- [Control Flow Guide](/docs/workflows-legacy/control-flow)


---
title: "Reference: Workflow.createRun() | Legacy Workflows"
description: "Documentation for the `.createRun()` method in workflows (legacy), which initializes a new workflow run instance."
---