Widget documentation

Quick start

Paste this line into every page that should have the assistant, before the closing </body>:

<script src="https://agentlab.lt/widget.js" data-agent="health" data-lang="en" async></script>

A round button appears in the bottom right corner. It opens the chat: the visitor picks a topic and presses Chat or Talk. Chat is typed, and the microphone button turns voice on at any time. Talk is by voice, like on the phone, and they can type during it; with no microphone, or if they do not allow it, it goes on by text. On a phone the chat fills the screen.

Minimising the chat does not end the talk: the button shows a green dot, and opening it again carries on. The talk ends with the red button or when the visitor leaves the page.

Settings

Settings are attributes on the <script> tag.

AttributeValueDefault
data-agentTopics, separated by commas: health, business, dijorus, anekdotai, chatgpt, or your own assistant's key from your account, such as a-1f2e3d4c5b6a. With one topic, only that one shows.the assistants on agentlab.lt’s homepage
data-langThe widget’s language: lt or en. The assistant answers in the language it is spoken to.lt
data-positionCorner: right or left.right
data-colorColour of the button and the header, as a hex code, e.g. #277ba9.#e5484d
data-manualNo button until you create it yourself with AgentlabWidget.mount().off
<script src="https://agentlab.lt/widget.js"
  data-agent="health,chatgpt"
  data-lang="en"
  data-position="left"
  data-color="#277ba9"
  async></script>

JavaScript

Once the script has loaded, the page has window.AgentlabWidget:

FunctionWhat it does
open()Opens the chat, for example from your own "Ask our AI" button.
close()Minimises the chat. The talk goes on.
toggle()Opens or minimises.
mount(options)Builds the widget again with other settings. A running talk ends.
unmount()Removes the widget from the page and ends the talk.

mount takes the same settings as the attributes, without data-:

<script src="https://agentlab.lt/widget.js" data-manual async></script>
<script>
  window.addEventListener('load', () => {
    AgentlabWidget.mount({ agent: ['business'], lang: 'en', position: 'right', color: '#737731' });
    document.querySelector('#ask-ai').addEventListener('click', () => AgentlabWidget.open());
  });
</script>

What your site needs

Privacy

The talk runs in a separate frame (iframe) from agentlab.lt. Your site does not see what the visitor says or types, and the widget does not read your page or its cookies, nor set any of its own. The chat’s frame loads only when the button is pressed.

Talks follow agentlab’s privacy policy: voice and text are processed by OpenAI and Anthropic, the text of a talk is kept for 30 days and audio is not recorded. Visitors agree to this when they start a talk. Mention the agentlab AI assistant in your own privacy policy.

Limits

Troubleshooting

The button does not show

Check the browser console. Most often a Content-Security-Policy blocks the script from https://agentlab.lt.

The chat is blank

Your CSP does not allow agentlab.lt’s frame: add frame-src https://agentlab.lt.

The microphone does not work

The page must be on HTTPS and its Permissions-Policy must allow the microphone for agentlab.lt. The visitor must also allow the microphone in the browser. Typing works either way.

It says talks are not available

These are the limits above: night time, the visitor’s country, or this hour’s time is used up. The widget lets them start again by itself once it can.

Questions? Write to hello@agentlab.lt.