Skip to main content
Have more than one agent? You can run them all from a single script tag instead of pasting a different snippet on every page. Each agent’s Display Rules decide which pages it shows on, and one default agent covers everything else. A SaaS app, for example, might put a Sales agent on /pricing and /plans, and a Support agent everywhere else – all from the same one line of code.

How it works

Instead of one agent’s apiKey, the workspace script uses a workspaceKey. That one key loads your whole workspace, then Chatref picks which agent to show on each page:
  • It checks every agent’s Display Rules against the page URL.
  • If a page matches an agent’s rules, that agent shows.
  • If no agent matches, your default agent shows.

Set it up

Copy the workspace script

On the Deploy page, switch to the Multi-Agent Routing tab and copy the workspace script. It uses a workspaceKey instead of one agent’s apiKey:
Paste it once into your site, just before </head> – the same place as a single-agent script. See Embed on Your Website for where that is on each platform.

Set each agent's Display Rules

Open each agent and set its Display Rules to the pages it should appear on. For the example above, the Sales agent matches /pricing and /plans.

Pick the default agent

Choose one agent as the default. It shows on every page that no other agent’s rules match – so the Support agent covers the rest of the site.
Start with two agents and one default, then add more as you grow. Keep the default agent broad so no page is ever left without an agent.

Next steps

Display Rules

Control which pages each agent shows on with URL match rules.

Embed on your website

Where to paste the script on WordPress, Shopify, Webflow, and more.