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.
| Attribute | Value | Default |
|---|---|---|
data-agent | Topics, 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-lang | The widget’s language: lt or en. The assistant answers in the language it is spoken to. | lt |
data-position | Corner: right or left. | right |
data-color | Colour of the button and the header, as a hex code, e.g. #277ba9. | #e5484d |
data-manual | No 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:
| Function | What 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
- HTTPS. Browsers allow the microphone only on secure pages. Over plain HTTP the widget works for typing only.
- Content-Security-Policy. If your site sends one, allow agentlab.lt’s script and frame:
script-src https://agentlab.lt; frame-src https://agentlab.lt. Styles are added without inline CSS, sostyle-srccan stay as it is. - Permissions-Policy. If your site restricts the microphone, allow it for agentlab.lt:
microphone=(self "https://agentlab.lt"). - Browsers. Current Chrome, Safari, Edge and Firefox, on computers and phones.
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
- Talks are open every day from 07:00 to 24:00 Lithuanian time.
- Talks are open only from the European Union and the United Kingdom.
- Talk time each hour is shared by all visitors, on agentlab.lt and in widgets alike. The wheel in the widget shows how much is left. A typed chat counts time the same way as a voice call.
- One message is up to 500 characters.
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.