> ## Documentation Index
> Fetch the complete documentation index at: https://docs.erstan.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Preview, Publish & Versions

> Test an agent in the builder, publish it live, manage versions, and share it with a team.

Before an agent does real work, you test it with Preview, then Publish it to make it runnable. After that, every change is a new version you can review or roll back, and you can share the agent with a team. This page covers the path from a working draft to a live, shared agent.

## Preview before you publish

Preview runs your draft agent inside the builder so you can try it without making it live or affecting anyone else.

<Steps>
  <Step title="Open the builder">
    Open the agent you are working on. The builder header shows **Save**, **Preview**, **Publish**, and **Share**.
  </Step>

  <Step title="Click Preview">
    The preview panel opens. Provide the trigger inputs — a chat message for an Assistant or Workforce, or the form fields for an Automation.
  </Step>

  <Step title="Watch the run stream">
    Steps run live with status updating in place. Open **Steps** to follow each node, and use the preview history to revisit earlier test runs.
  </Step>

  <Step title="Iterate">
    Adjust instructions, steps, skills, or connections, **Save**, and run Preview again until the agent behaves the way you want.
  </Step>
</Steps>

<Note>
  Preview runs are tagged **Preview run** in the agent's run history, so you can tell test runs apart from real ones. See [Run history, traces & analytics](/agents/run-history-traces).
</Note>

<Warning>
  A preview is a real run: if a step writes to NetSuite or another system, it still pauses for approval (or, with **Auto-approve writes** on, performs the write). Preview with read-only inputs first, or keep write tools set to **Require approval**. See [Approving and rejecting AI actions](/chat/approvals).
</Warning>

## Publish to go live

Publishing turns a **Draft** agent into a **Live** agent that can be run on demand, on a schedule, or from a trigger.

<Steps>
  <Step title="Save your latest changes">
    Make sure your draft is saved. Resolve any **Connections** or **Trigger setup** warnings in the builder first — a required connection that is missing will block runs later.
  </Step>

  <Step title="Click Publish">
    From a draft agent, click **Publish** in the builder header. The agent's status badge changes to **Live**.
  </Step>

  <Step title="Run it">
    A published agent shows **Run** in place of **Publish**. You can now run it from the library, the runs page, or the builder. See [Running agents](/agents/run-and-tasks).
  </Step>
</Steps>

### Publishing gates: Run As

For agents that start automatically — an Automation with a **Form** or **Schedule** trigger — Erstan needs to know which user identity the run executes under before it will let you publish. This is the trigger's **Run As** setting.

Run As decides whose NetSuite authorization and permissions an automated run uses, since there is no person in the chat to act as. The builder surfaces its state:

| Run As state      | What it means                                                         |
| ----------------- | --------------------------------------------------------------------- |
| **Configured**    | A valid identity is set; publishing is allowed.                       |
| **Needs Run As**  | No identity chosen yet — set one to continue.                         |
| **Needs consent** | The chosen user must consent to the agent acting as them.             |
| **Wrong user**    | The configured user no longer matches; reselect.                      |
| **Not available** | The identity can't run this agent (e.g. not authorized for NetSuite). |

<Warning>
  Run As means an automated run acts with that user's NetSuite role and permissions, including any write access. Choose the identity deliberately, and keep write-capable tools on **Require approval** unless you have reviewed the agent end to end. See [Security & write safety](/security/overview).
</Warning>

<Tip>
  If you publish an agent and then keep editing, the live version and your draft drift apart. When you try to run an agent with unsaved edits, Erstan prompts you to **Save** so the latest draft becomes the version that runs.
</Tip>

## Lifecycle: Draft, Live, Archived

Every agent sits in one of three states, shown as a badge in the library and the builder.

<CardGroup cols={3}>
  <Card title="Draft" icon="pencil">
    A work in progress. You can Preview it, but it isn't runnable from triggers, schedules, or the library run action until you publish.
  </Card>

  <Card title="Live" icon="circle-check">
    Published and runnable. Shows **Run** in the builder and appears as a runnable agent across the workspace.
  </Card>

  <Card title="Archived" icon="archive">
    Retired. Archived agents cannot be run. Archive from the agent's context menu in the library; unarchive to bring it back.
  </Card>
</CardGroup>

You can filter the [Agents library](/agents/overview) by **Status** (Live / Draft / Archived) to find agents in any state.

## Versions and rollback

Each time you publish, Erstan saves a snapshot, so the builder tracks **Live**, **Draft**, and **History** versions of the agent.

<Steps>
  <Step title="Open Version history">
    In the builder header, open **Version history** to see past versions of the agent.
  </Step>

  <Step title="View a historical version">
    Select a version to view the exact steps and instructions it contained.
  </Step>

  <Step title="Restore this version">
    Click **Restore this version** to bring an earlier snapshot back as your current draft, then Preview and Publish it like any other change.
  </Step>
</Steps>

<Info>
  Restoring loads the older version as a draft — your current work isn't discarded silently. Review it with Preview, then Publish when you're ready for it to go live.
</Info>

### Duplicate

Use **Duplicate** to make an independent copy of an agent — for example, to experiment without touching the live one, or to fork a read-only agent (such as a Marketplace template or a built-in agent) into one you can edit. The copy starts as its own Draft.

## Share an agent with a team

Publishing makes an agent runnable; **sharing** controls who in the workspace sees and can use it.

<Steps>
  <Step title="Open Share">
    Click **Share** in the builder header.
  </Step>

  <Step title="Choose who can access it">
    Share the agent with a team so its members can run it, or keep it to yourself while you build. Agents shared with you appear under the **Shared with me** preset in the library.
  </Step>
</Steps>

<Note>
  A shared agent still runs under each person's own NetSuite authorization. Sharing grants access to the agent; it does not grant access to NetSuite data the runner isn't already authorized to see. See [Authorizing your NetSuite user](/connectors/netsuite-authorize).
</Note>

## Next steps

<CardGroup cols={2}>
  <Card title="Running agents" icon="play" href="/agents/run-and-tasks">
    Run a live agent on demand or assign it as a task.
  </Card>

  <Card title="Scheduling recurring runs" icon="calendar-clock" href="/agents/schedules">
    Run an agent automatically on a schedule.
  </Card>

  <Card title="Run history, traces & analytics" icon="list-checks" href="/agents/run-history-traces">
    Track every run and read its step-by-step trace.
  </Card>

  <Card title="The visual builder" icon="workflow" href="/agents/builder">
    Design steps, connections, and triggers on the canvas.
  </Card>
</CardGroup>
