# Test mode

Test your agent against your live production site without polluting analytics, conversations, or reports with your own test traffic.

Test mode lets you talk to your agent on your real production site while keeping the conversation out of your data. Sessions started in test mode are flagged as test traffic, so they never count toward your analytics, and they stay out of the default Conversations list. Use it to smoke-test a new action, a knowledge update, or a copy change against production without your own messages skewing reports.

Turn it on from the browser console with `setTestMode`. No redeploy, no separate staging agent.

:::note[Prerequisites]
The [SDK is installed](/start/install/) on your production site.
:::

## Enable test mode

Open your production site, open the browser console, and run the snippet that matches how the agent is mounted. `foldspace.agent()` resolves an instance by mount mode plus Agent API Name, so an [embedded](/guides/embedded-agent/) agent needs `mode: 'EMBEDDED'` here too.

  
**Embedded**

  ```javascript
  foldspace("when", "ready", () => {
    foldspace.agent({
      apiName: "YOUR-AGENT-KEY",
      mode: "EMBEDDED",
    }).setTestMode(true);
  });
  ```

  
  
**Floating widget**

  ```javascript
  foldspace("when", "ready", () => {
    foldspace.agent({
      apiName: "YOUR-AGENT-KEY",
    }).setTestMode(true);
  });
  ```

  

Replace `YOUR-AGENT-KEY` with your Agent API Name from **Agent Studio → Setup**. Once it's on, the agent shows a striped banner so you always know the current session is being excluded from your data:

<TestModeBanner />

Every conversation you start while the banner is showing is tagged as a test session.

## Check which agent you're targeting

If the banner doesn't appear, `setTestMode` ran on an agent that isn't the one on screen. A mode that doesn't match the mounted instance resolves to an id nothing is registered under, and the SDK creates a new agent there rather than failing, so the call succeeds and the page doesn't change.

List every agent the SDK has mounted:

```javascript
foldspace.agentIds();
// → ['overlay-support-agent', 'embedded-support-agent']
```

Each id is the mount mode plus your Agent API Name: `embedded-support-agent` is `support-agent` mounted with `mode: 'EMBEDDED'`, and `overlay-support-agent` is the same key as the floating widget. Resolve the one you want with the matching `mode`, and pass the Agent API Name to `foldspace.agent()`, not the id.

## Turn it off

Test mode is scoped to the current page session. Reload the page to clear it, or turn it off explicitly:

  
**Embedded**

  ```javascript
  foldspace.agent({
    apiName: "YOUR-AGENT-KEY",
    mode: "EMBEDDED",
  }).setTestMode(false);
  ```

  
  
**Floating widget**

  ```javascript
  foldspace.agent("YOUR-AGENT-KEY").setTestMode(false);
  ```

  

## `setTestMode(enabled)`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | Yes | `true` flags all new sessions on this page as test traffic and shows the banner. `false` returns the agent to normal tracked behavior. |

## See your test conversations

Test sessions are hidden from **Agent Studio → Conversations** by default so real user activity stays clean. To surface them, filter by source:

1. In the Conversations filter bar, open the **Source** filter. If it isn't showing, add it from **+ Add filter**.
2. Check **SDK Test** (test-mode sessions are recorded under this source), then **Apply**.

The list now shows your test conversations. Open one to check the [timeline and View Analysis](/user-guides/conversations/) and confirm the agent behaved as expected. Leave **Live Agent** unchecked to see test traffic on its own.

:::note
Test sessions are excluded from analytics whether or not you filter for them. The **Source** filter only controls what you *see* in the Conversations list; it doesn't change what gets counted.
:::

:::caution
Test mode only affects the browser session where you called `setTestMode(true)`. It does not put your production agent into test mode for other visitors, and it is not a way to hide the agent from real users.
:::

## Related

- [Conversations](/user-guides/conversations/): review and filter sessions, including test traffic.
- [Application events](/reference/track-api/): send your own product events into analytics.
- [Visibility](/reference/visibility-api/): show, hide, open, or close the agent from code.
