# Drafts and versions

> How a draft becomes an immutable version, which version each trigger and mode runs, and the statuses a version can have.

Source: https://docs.sommatic.ai/en/workflows/lifecycle/versions/ (updated 2026-11-26)

A workflow has two lives at once: the draft you are editing and the versions you have published. Knowing which one a call runs is the difference between a safe change and a surprise in production.

## From draft to version

1. **Edit the draft.** Every **Save draft** in the studio, every `PATCH` of the flow definition and every sync from Git
   replaces `draft_nodes` and `draft_edges`.
2. **Publish.** **Deploy** in the studio, or `POST /workflow-orchestration/control-plane/flow-design/flow-definition/:id/publish`,
   copies the draft into a new flow version:
   - its number is the highest existing number plus one;
   - it becomes the default version (`is_default: true`), and the previous default stops being one;
   - the flow definition records it in `latest_version_id` and `version_counter`.
3. **Run.** From then on, production calls run that version. The draft can keep changing without affecting them.

An empty draft cannot be published. Publishing never changes an existing version: to roll back, open the history in
the studio, **Restore** an earlier version into the draft, save it and publish again.

## Which mode runs what

| Started by                                               | Mode | Runs                                                                                         |
| -------------------------------------------------------- | ---- | -------------------------------------------------------------------------------------------- |
| **Run workflow** in the studio                           | test | The saved draft                                                                              |
| Webhook URL with `test`                                  | test | The saved draft                                                                              |
| Webhook URL with `prod`                                  | prod | The default published version                                                                |
| `cron.trigger` or `connectors.microsoft.outlook.trigger` | prod | The default published version (only active workflows with a published version are scheduled) |
| `workflow.chain` from a test run                         | test | The draft of the target workflow                                                             |
| `workflow.chain` from a published run                    | prod | The default published version of the target workflow                                         |

> **Warning: Saving a draft is live for test traffic**
>
> Anything that calls in `test` mode sees your draft as soon as you save it. Keep integrations that must be stable on
> `prod` URLs.

Each run reads its graph when it starts. A run that is already in progress keeps the graph it started with.

## Version statuses

Only the default version (`is_default: true`) receives production traffic; when no version is marked as default, the
most recent one is used. Besides the common statuses, a version can be marked `deprecated`, and deleted versions are
ignored when Sommatic AI picks the version to run or numbers the next one.

## Next steps

- [Workflow Studio](https://docs.sommatic.ai/en/workflows/studio.md): Edit the draft, test it and deploy it.
- [Publishing](https://docs.sommatic.ai/en/workflows/publishing.md): Versions, rollbacks, warnings and pausing a workflow.
- [Workflow design API](https://docs.sommatic.ai/en/api/reference/workflow-design.md): Flow definitions, versions and publishing over HTTP.
