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

# Test and publish an agent

> Try an agent in the test chat or on WhatsApp, publish a draft to new or open chats, and use version history to roll back.

Customers always talk to the published version of an agent. Everything you change on the agent page, from instructions to connected numbers, is saved as a draft first, so you can review the exact differences and decide which conversations get the update. Every publish and rollback is kept in the version history.

## How drafts and versions work

* Editing anything shows a banner such as **2 unpublished changes. Live conversations use the published version.** with **Discard**, and the header button becomes **Save and review**. **Discard** returns the page to the last saved state. On a phone, **Save and review** and **Discard** are pinned across the top of the page.
* **Save and review** checks your fields (a field to fix opens its tab), saves your changes to the agent, creates a draft and opens the **Publish changes?** dialog. There is one draft per agent; saving again updates it. If you close the dialog without publishing, the header button becomes **Publish changes**.
* The first time you save an agent that has no versions yet, Popcorn also records the agent as it was before your edits as a published version with the note **Initial published version**, so you always have something to roll back to.
* Until you publish, the published version keeps answering customers. The page tells you where you are: **This agent isn't published yet. Publish it to start answering customers.**, the unpublished-changes banner above, or, once nothing is waiting, "New chats use v4, published Sep 12, 2026."
* Publishing needs a role that can edit agents.

## Try the agent in the test chat

**1. Open the test chat**

On the agent page, from 1280 pixels wide, the **Test your agent** panel sits beside the settings. On a narrower screen, click **Test agent** in the header (**Test** on a phone) to open it in a dialog titled **Test** followed by the agent's name.

**2. Chat as a customer**

Type a message and send it. Under each reply, a line shows what the agent did: **Searched the knowledge base** or **Used** followed by the tool's name. A reply that has just arrived shows that line once the conversation is opened again. When the agent hands over, the chat shows **Handed to your team**.

**3. Start over when needed**

**Start a new conversation** asks **Start a new conversation?**; click **Start over** to begin a fresh one. **Open in new tab** opens the same chat in a tab.

> [!NOTE]
>
> The test chat talks to the **published** version, exactly like your customers. Edits you have saved but not published are not reflected. To try a change, publish it, then start a new conversation so the next message starts on the new version. To hear a **Voice** before you publish it, use **Preview replies** on the **Instructions** tab instead (see [Popcorn's rules and Voice](https://docs.trypopcorn.ai/agents/popcorns-rules.md)). (A brand-new agent has no published version until its first save on the agent page; until then the test chat uses the settings it was created with.) Test conversations are real conversations: they appear in your Inbox and each AI reply uses one credit like any other. If the workspace is out of credits, the chat shows **Your agent stopped replying to customers** with **Top up credits** (or **Choose a plan** on the free plan).

### The free test chat on Home

While your workspace has no WhatsApp number connected and no customer conversations yet, **Home** shows your agent's setup with a **Try your agent** panel ("Ask what a customer would. Nothing is sent to WhatsApp."). The same chat appears during onboarding as **Try it as a customer**. Chats there are free: they use no credit, they are kept in **Test conversations** (under **More folders** in the Inbox) so reports and lead counts leave them out, and a handover in them alerts nobody. Chats started from the agent page, the **Test agent** dialog or the sandbox are not free tests.

## Try the agent on WhatsApp with the sandbox

The sandbox is a shared Popcorn test number, useful before you connect your own WhatsApp number. It is answered by your workspace's **default** agent.

**1. Open the sandbox**

On the agent's **Channels** tab, click **Manage sandbox numbers**. The **Test on WhatsApp** dialog ("Chat with your agent from your own phone before customers do.") opens.

**2. Register your phone**

Under **1. Add the phone you'll test from**, enter your WhatsApp number with the country code under **Your phone number** and click **Add number**. You see **Number added** (with **Undo**), and the number is listed as **No messages yet** until it sends its first message, then **Active**. If it fails, check the number: a phone can test with only one Popcorn AI account.

**3. Message the test number**

Under **2. Message the test number**, scan the QR code with your phone or click **Open WhatsApp**, and send the pre-filled message. The default agent replies on WhatsApp; the conversation appears in your Inbox and uses credits like a live conversation. Remove a number with the button next to it (**Remove** followed by the number).

If your number is not registered, the sandbox replies that it is not linked to any organization. If the workspace has no default agent, it replies that your organization does not have a default agent set up yet; choose one from the **Agents** page with **Set as default**.

### Start over on WhatsApp

When you test from your phone, on the sandbox or on one of your own numbers, you can reset the chat by sending a command on its own, exactly as written:

| Send | What happens |
| - | - |
| `/reset` (or `/start`) | Your next message starts a new conversation. The agent still remembers your earlier conversations with that number, as it does for any returning customer. |
| `/reset-all` | Your next message starts a new conversation, and the agent forgets everything from that number before the reset: earlier messages and their summary, past orders, and the address given before. Use it when a test should start clean. |

Popcorn answers the command itself, without the agent, so it uses no credit: "Conversation reset successfully. Please send a message to start a new conversation." (or "Conversation and history reset successfully. …" for `/reset-all`). Everything stays in your Inbox. The commands work for anyone who messages your numbers, customers included.

## Publish changes

**1. Save and open the review**

Click **Save and review** (or **Publish changes** in the header when a draft already exists). The **Publish changes?** dialog opens ("Customers get these changes once you publish.").

**2. Check what changed**

**What changed** lists the areas that differ from the published version, with a count: **Name and instructions**, **Messaging and notification settings**, **Capabilities, tools and knowledge**, and **Connected WhatsApp numbers**. Click **Show before and after** to compare **Before** and **After** field by field. For an agent with nothing published, the dialog says "Nothing is published yet, so this will be the first version."

**3. Choose who gets the update**

Under **Who gets this update**, the default is **New chats only**. Choose **New chats and chats in progress** to include chats that are already running (see the table below).

**4. Add a note and publish**

Optionally write a **Note about this version (optional)**; it appears in the version history so your team knows what changed. Click **Publish changes**. You see **Changes published** together with how many open chats were updated.

### What the publish options mean

| Option | What happens |
| - | - |
| **New chats only** (default) | Only conversations that start after publishing use the new version. Chats already in progress keep the version they started with. |
| **New chats and chats in progress** | Open conversations the AI is handling on this agent's channels switch to the new version from their next AI reply. The dialog shows an estimate ("About N open chats switch to this version right away.") and suggests this for urgent fixes, like a wrong price or policy. |
| **Also include chats a teammate is handling** | Extends the update to open conversations a teammate has taken over; when the agent takes these chats back, it uses this version. Available only with the option above. |

Two more things happen at publish time:

* Numbers you switched off move their open conversations to the default agent immediately, whatever you chose above. The dialog warns you: "The agent stops answering on these N numbers, and their open chats move to your default agent right away", and lists them.
* Any other draft of this agent is archived, so only the version you just published can be rolled back to.

## Version history

Click **Version history** in the agent header to open **Versions** ("Every saved and published version of this agent, and how each one did."). Each entry shows the version number, a status of **Published**, **Draft** or **Archived**, the publish or save date and time, the note you wrote (or **No note**), and five figures:

| Figure | Meaning |
| - | - |
| **Chats** | Conversations that ran on this version |
| **Handed to team** | Share of those conversations handed to a human |
| **Closed** | Share of those conversations that were closed |
| **Ordered** | Orders placed in those conversations, as a share of conversations |
| **Tool errors** | Share of tool calls that failed |

The live version is marked **Customers are on this version**; archived versions have a **Roll back** button.

## Roll back to an earlier version

**1. Pick the version**

In **Versions**, click **Roll back** next to the version you want. The **Roll back to vN?** dialog opens: "vN becomes the published version again. Your current version stays in the history."

**2. Review what it changes**

**What changes back** compares the current version with **After rollback** for every area that differs. If you had unsaved changes on the page, the dialog warns that they will be discarded.

**3. Choose who gets it**

Under **Who gets this version**, the default is **New chats only**. Choose **New chats and chats in progress** to switch open AI conversations from their next reply, and **Also include chats a teammate is handling** to extend that to conversations a teammate has taken over.

**4. Give a reason**

**Why are you rolling back?** is required (**Add a reason to roll back.**). Your team sees it in the version history.

**5. Confirm**

Click **Roll back to vN**. You see **Rolled back to vN**.

A rollback does not reuse the old version number: Popcorn creates a new published version with the old version's contents and your reason as its note, archives the version that was live, and discards any unpublished draft.

## When publishing or rolling back fails

| Message | What to do |
| - | - |
| **Draft is out of date with the live agent configuration. Save your changes again before publishing.** | Something changed on the agent after the draft was saved, for example a teammate saved edits or you connected Slack. Click **Save and review** again. |
| **One or more WhatsApp channels in this version no longer exist. Save your changes again before publishing.** | A number in the draft was removed from the workspace. Save again. |
| **One or more WhatsApp channels are connected to another agent** | Switch the number off on the other agent (and publish there) first. |
| **Cannot apply this version: secret header(s) … can no longer be restored from the live agent.** | The version uses a tool whose credentials are no longer on the agent. Reconnect the tool's credentials, then try again. |
| **Couldn't prepare your changes for publishing** | The edits were saved to the agent but no draft was created. Click **Save and review** again before publishing. |
| **Nothing to publish yet. Save your changes first.** | There is no draft. Make a change and click **Save and review**. |

## Related

* [Connect knowledge, tools, channels and notifications](https://docs.trypopcorn.ai/agents/connect-knowledge-tools-channels.md)
* [Spotlight](https://docs.trypopcorn.ai/agents/spotlight.md): quality scores for the conversations each version handled.
* [Troubleshooting AI agents](https://docs.trypopcorn.ai/agents/troubleshooting.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.