# Put an agent inside your product

Install a copilot, onboarding or training agent in your own app, know what your users see and are asked, try it on staging first, and brief your developer.

Copilot, onboarding and training agents work inside your own product, in your user's own browser tab, beside the screen they are using. Your developer adds one install code to your app once. The code is tied to one agent and never expires: edits you save to the agent reach your app with no change to the code.

These agents are available when your workspace has Copilots, Onboarding or Training. Insurge turns these on; if you don't see them under **Agents** in the left rail, ask your Insurge contact.

## What it does for your users

| Agent | What your users get |
|---|---|
| **Copilot** | Answers and points the way inside your app. Users ask by voice or by typing; it answers out loud and on screen, and points at the control they need. |
| **Onboarding** | Takes new users through setup, step by step, in the real app. |
| **Training** | Teaches your team tasks in the real app and checks them. |

How much it may do in your user's app is set on the agent's **Behaviour** tab, under **What it may do** → **Actions**:

- **Guide only**: it points at things and explains, and never clicks.
- **Act when asked** (recommended): it can click and type to show them, and asks before anything that saves, sends or deletes.

Onboarding and training agents run programs of tasks you build: see [Guides and programs](/docs/knowledge/guides-and-programs).

## Before you start

- You need the **Admin** role.
- The agent is set up, **Live**, and tried. See [Preview and test](/docs/agents/preview-and-test).
- You know the address your app runs at, and your staging address if you test there first. Each starts with `https://`.
- A developer who can edit your app's base layout, the template every page uses.

## Get the install code

### Open the agent's Install tab

In the left rail under **Agents**, open **Copilots**, **Onboarding** or **Training**, then the agent. Open its **Install** tab. The **On your site** section walks you through the install. The badge beside the title counts the steps done, and says **Ready to install** when all are.

These agents always install as a script, because they have to see your app; **Inside the page** isn't available for them.

### Turn it on and choose how it appears

Switch on **Allowed on websites**. Then choose:

- **How it appears**: **Always on the page** keeps a slim ask box on every page, and nothing starts until someone asks. **Opens on a click or ⌘/** shows only a small pill; users open it with the pill or with Ctrl+/ (⌘/ on a Mac). There is no chat bubble either way, so your own support widget keeps its place.
- **Where**: **Bottom centre**, **Bottom right** or **Bottom left**.

Phones always get the small pill.

### Choose the sites it can appear on

Type your app's address on its own row, such as `https://app.example.com`, and press **Add site** for your staging address. Write the address only, with no page path. `https://*.example.com` covers every subdomain. Every agent in the workspace shares this list.

### Save, then copy the code

Press **Save changes**. Then press **Create install code** ("Tied to this agent. It never expires.") and **Copy code**. It goes before `</body>` in your app's base layout, so it is on every page.

### Send it to your developer

Under **Then send it to whoever runs the site**, press **Copy** and send the instructions. They say where the code goes, how to check it and which security settings in your app can block it.

## What your users see and are asked

| Moment | What happens |
|---|---|
| Opening it | The ask box says "Ask about this screen…". Users type, or press the mic and talk. Answers are spoken and written; users can mute the voice and still read the answers. |
| The microphone | The browser asks for permission the first time they press the mic. If they block it, typing and the buttons still work, and the box says how to allow the mic from the address bar. |
| Who they are | With **Visitor form** on (on the **Install** tab, under **Links**), the agent asks once per visit, inside its own box, before its first answer: "Tell me who you are first — I won't ask again." It skips this when your app already tells Insurge who the user is. Leave the form off when your users are signed in to your product. |
| Before it presses something | With **Act when asked**, the agent stops before a control that saves, sends, pays or deletes, says what it is about to do, and offers **Yes, do it** and **No**. It goes ahead only on yes. |
| What it can see | The guide's panel says "AI guide. It can make mistakes." Its **What can it see?** link tells users: "This guide is an AI. It can see the names of buttons and fields on your screen and the pages you open, not what you type into password or card fields. Your organisation can see your progress and your questions. It reads its lines aloud until you mute it. It only listens while the mic is on, and audio isn't stored." |

Sessions inside your app aren't recorded. A copilot's conversations appear on its **Conversations** tab; an onboarding or training agent's people and their progress on its **People** or **Learners** tab.

If your workspace runs in-app guides, **Settings → Guide** holds what every guide shares, including **Ask before pressing** (controls it must always ask about) and **Never point at** (controls it must keep people away from).

## Try it before your users see it

### On staging

Add your staging address to the sites, save, and have your developer put the install code on staging. When **Check it is on your site** shows your staging address, open your app there and ask it something real.

### On your live app, for testers only

Switch on **Testers only** under **Allowed on websites** and save. The agent then shows only in a browser that has opened a page of your app once with `?insurge_preview=1` at the end of its address. That browser remembers it; open a page with `?insurge_preview=0` to forget it. Everyone else sees nothing, and your app's own code that talks to the agent keeps running. Switch **Testers only** off when you're ready.

### Its answers on their own page

Under **Links**, **Create link** opens the agent's ask box on a page of its own, a quick way to try its answers. It can't see your app there. See [Share links](/docs/share/share-links).

### On a site with no install yet

To show this agent on a site before the code is installed there, for a stakeholder or a demo, ask your Insurge contact for a demo link.

## What to ask your developer

Send the instructions from the **Install** tab, and ask them to:

1. Put the install code before `</body>` in the app's base layout, so it is on every page.
2. Serve the app over HTTPS. On a plain `http://` page the agent doesn't appear at all (`http://localhost` is the one exception, for testing).
3. Allow Insurge's addresses in the app's Content-Security-Policy, and the microphone in its Permissions-Policy, if the app sends those headers. The instructions list the exact values.
4. Tell Insurge who the signed-in user is, so the agent doesn't ask and greets them by name.
5. Optionally, open the agent or ask it a question from your own button or help menu.

The technical reference for all of this is [the developer guide to in-app installs](/docs/developers/in-app).

## Take it off

- To hide it everywhere, switch off **Allowed on websites** and save, or switch the agent to **Paused** at the top of its page.
- To hide it on one site, remove that site from the list and save. This hides every agent on that site.
- To remove it for good, ask your developer to take the code out.

## Troubleshooting

#### Nothing appears in the app

Check, in order: the badge says **Ready to install**; the agent is **Live**; **Allowed on websites** is on and saved; the app's exact address is in your sites; **Testers only** is off, or you opened the app with `?insurge_preview=1`. Changes can take up to a minute to reach browsers. If **Check it is on your site** says "Not in your sites, so it stays hidden there.", add that address and save.

#### It only shows a small pill

That is how it appears on phones, and with **Opens on a click or ⌘/**. Press the pill, or Ctrl+/ (⌘/ on a Mac).

#### It explains but never clicks

**Actions** is set to **Guide only**, or the session came from a demo link, where it only points and never presses anything. Choose **Act when asked** on the **Behaviour** tab and save.

#### Users can type but not talk

The browser blocked the microphone, or the app's Permissions-Policy header blocks it. Users can allow the mic from the address bar; the header is for your developer.

#### It asks signed-in users who they are

Your app isn't telling Insurge who the user is. Turn off **Visitor form** on the **Install** tab, or ask your developer to identify the user. See [the developer guide to in-app installs](/docs/developers/in-app).
