# Drafts and publishing

A flow moves through three clearly separate stages: you **edit** it as a draft, you **test** that draft with Run Draft, and you **publish** it to create a version. Publishing alone doesn't put a flow to work — you then **activate** it so its trigger goes live. This page covers editing state, the version selector, the checks before publishing, publishing the current draft, and what comes next.

**Permissions.** Editing, publishing, and activating flows requires the **Admin** or **Partner** role. See [Users and access](../onboarding/users-access.md).

## Editing the draft

The **draft** is the working copy of a flow — the version you change in the builder. Your edits are saved automatically as you work, and a status badge shows where those changes stand:

- **Synced** — all your changes are saved.
- **Saving** — a save is in progress.
- **Unsynced** — you have changes that haven't been saved yet.

A draft is edited by one person at a time. If someone else is already editing, you'll see the draft as read-only until editing is handed over.

**Connection state.** The builder shows whether it's **connected**. If it's reconnecting or disconnected, your changes can't sync until the connection is restored — wait for it to reconnect before relying on the synced status.

## The version selector

The version selector lets you switch between the **Draft** and any **published versions** of the flow:

- **Draft** is the editable working copy.
- A **published version** is a snapshot that was published earlier. Viewing one is **read-only** — to make changes, switch back to Draft.

A brand-new flow starts in Draft. A flow that already has published versions opens at its latest published version, and you switch to Draft to keep editing.

## Before you publish

Publish from a draft that you've tested and that passes the builder's checks.

- **Test it first.** Run the draft with sample input and confirm each step behaves as expected. See [Test and debug a draft](./test-debug-draft.md).
- **Resolve validation issues.** The builder validates the flow's structure — every node should be connected into the flow (no orphaned nodes), and every connection and branch should lead to a real next step. The flow also needs a trigger. Fix any reported issues before publishing.

## Publish the current draft

When the draft is ready, click **Publish**. Publishing creates a new published version of the flow from the current draft, recorded with when it was published and optionally a short note describing what changed. Your draft remains available for further editing after you publish.

Publishing creates the version; it does not by itself start processing. For the flow to run on its trigger, it must be **active**.

## Go live: activate the flow

A flow is either **active** or **inactive**, shown by a badge next to the flow name:

- **Active** — the trigger is live and starts runs as new inputs arrive.
- **Inactive** — no new runs are triggered.

Activate the flow from the published version to put it to work. Deactivating stops new runs from starting; in-flight work isn't started again once the flow is deactivated.

**Editing an active flow.** You keep editing in the draft while the published, active version continues running. The flow doesn't pick up your changes until you publish a new version and activate it. The builder warns you when you start editing or deactivate an active flow so the change is deliberate.

## After publishing

Once a flow is published and active, it processes real inputs. From here:

- **Watch its runs.** Use **View Runs** in the builder, or [Run history](../monitor-review/run-history.md), to confirm runs succeed and to investigate failures.
- **Handle review items.** Items the flow sends to review appear in [Human review](../monitor-review/human-review.md).
- **Iterate safely.** Make changes in the draft, test with Run Draft, then publish and activate a new version when you're confident — the active version keeps running in the meantime.

## Where to go next

- [Test and debug a draft](./test-debug-draft.md) — validate a draft before publishing.
- [Configure environments and variables](./environments-variables.md) — the environment a published flow runs in.
- [Run history](../monitor-review/run-history.md) — monitor a live flow's runs.
- [Human review](../monitor-review/human-review.md) — act on items a flow flags.
- [Build AI Agents](./overview.md) — the full build lifecycle.
