A hotel front desk has a person behind it. Guests talk to that person, but the person does not decide the room rates, the check-out time or who gets an upgrade. Those come from the hotel’s rules and from a manager who can be called over.
An avatar for an AI employee works the same way. It is the face at the desk: it speaks, it listens, it can be interrupted. What it is allowed to say and do still comes from the workflow behind it, which a person in your workspace built and published. The face changes how the conversation feels, not who is in charge.
This post is for the developer adding that face to a page you own: how the page loads it, how the keys stay safe, what you can set, how listening and interrupting work, and what is not built yet.
What is the avatar component?
It is one web component, <vai-avatar>, that you place on any web page. It renders a lip-synced 3D avatar in the visitor’s browser, speaks each of the AI employee’s replies aloud, and can listen for the visitor’s spoken answer using voice-activity detection. It also accepts typed messages, so you can offer a text box next to it.
It is plain JavaScript with no framework dependency. Once it has the values from a started conversation, it handles the live connection for replies, the speech in both directions and the rendering itself.
You never have to use it. Wetel is built to sit behind your own screens, and a plain text chat needs only the session events, with no avatar at all (see how people reach an AI employee for the other ways in).
How does a page load it?
With one script tag. This is the snippet from the docs:
<script type="module" src="https://your-avatar-service-host/sdk/vai-avatar.js"></script>The address is your environment’s avatar service; ask your Wetel contact for the right one. The script has no build step and loads its 3D rendering libraries itself the first time it runs.
One rule matters if your site is a single-page app: put the script tag on the page once and leave it there. Removing it and adding it again in the same page session throws an error and the avatar fails to start. If your app mounts and unmounts the avatar, add and remove the <vai-avatar> element, never the script tag.
How do the keys stay off the browser?
Your API key never goes near the page. The flow has two halves:
- Your backend starts the conversation with
sdkStart, using your long-lived API key, which stays in your server’s environment. - Your page receives only what that call returned: the session id, a short-lived session token (
avatarToken), the API address and the avatar service address.
In short: the visitor’s page asks your backend, your backend starts the conversation with Wetel using the API key, and only the session id and a short-lived token go back to the page, which connects the avatar with them.
sequenceDiagram participant P as "Your page" participant B as "Your backend" participant W as "Wetel" P->>B: "Visitor opens the page" B->>W: "sdkStart with your API key" W-->>B: "Session id and short-lived token" B-->>P: "Session id and token only" P->>W: "Avatar connects with the token"Those four values are the component’s four required attributes: session-id, token, graphql-endpoint and avatar-service. The element does nothing until all four are present. The token is the same short-lived credential used to send messages and end the conversation, never a long-lived key. The attribute names are chosen so you can map the sdkStart response straight onto the element; the worked example shows every line.
Attributes are live. Change one (a different model, or a new session id and token to move to another conversation) and the element reconnects with the new values, batching several quick changes into one reconnect. The two speech-recognition language attributes are the exception: they are read fresh on each speech request and need no reconnect.
For more on why the key and the token are different things, see how API keys are scoped.
Which browser origins can connect?
Only allow-listed ones. A valid key or token is not enough on its own: if your page’s origin is not on Wetel’s allow-list, the browser refuses to connect to the API and to the live subscription. Some common hosting platforms are covered already. A custom domain, or another hosting provider, has to be added on Wetel’s side first, so ask before you go live. An unexplained connection error on an otherwise correct page is almost always this (CORS details).
What can you set?
Each agent carries its own look and voice, and your workspace has one set of defaults behind them.
On the agent (the values sdkStart hands back for the attributes):
| Setting | What it does | Documented limit |
|---|---|---|
avatarGlb | Which 3D model file to show | Must be a model from the catalog; agentConfigOptions lists them |
avatarGender | The avatar’s gender code | M or F |
ttsVoice | The voice that speaks the replies | A voice name from the speech engine’s own list |
ttsLang | The speaking language | Must match the voice |
voiceTier | The voice quality tier | Must match the voice |
speakingRate | How fast it speaks | 0.25 to 4.0, where 1.0 is normal speed |
lipsyncLang | The language the mouth movements use | Only en is verified in current deployments |
vadThreshold | How loud and clear speech must be | 0.1 to 1.0; lower is more sensitive and may react to background noise |
For the whole workspace, avatarConfig and upsertAvatarConfig read and write one row of defaults (gender, model, voice tier, language, speaking rate). There is exactly one per workspace, you send only the fields you are changing, and a value set on the agent always wins. One trap: the workspace setting spells gender FEMALE/MALE and the agent setting spells it F/M. They are different settings; do not copy one value into the other.
Two pieces of voice advice from the docs. First, the voice name, language and tier have to agree, so set all three from the same row of the speech engine’s list. Second, the voice list and the language list belong to the speech engine, not to Wetel, and agentConfigOptions returns links to both, plus a short list of recommended voices to start from. The languages and voices guide covers both choices.
How does it listen, and in which language?
When the visitor speaks, the component sends the audio for transcription and then sends the text on as the visitor’s message. The language it listens for follows the agent’s settings:
- Primary language: if you set none, it follows the speaking language, and then English.
- Alternatives: at most 3. Leave them unset for the default (English and Malay), or set an empty list for “primary only”.
- Chinese is not in the defaults on purpose, because accented English was sometimes mistaken for it. If your visitors speak Chinese, make it the primary.
For a longer look at mixed-language speech, see voice notes in English, Malay and Chinese.
You can also drive it yourself: sendText() sends a typed message, sendAudio() sends a recording from your own push-to-talk button, and speak() makes the avatar say a line your page provides. Call them only after the vai-ready event; before that they are ignored.
Can a visitor interrupt it?
Yes, but not automatically, and that is deliberate. Without a headset, the microphone hears the avatar’s own voice, so treating every sound as an interruption would trigger on echo all the time. Instead:
setVoiceActive(true), called when the visitor presses a push-to-talk button, arms the interruption. The next sustained speech while the avatar is talking counts as a real interruption.handleBargeIn()stops the reply at once, for a plain “stop” button.
When an interruption is confirmed, the audio stops in the browser first, with no network round trip, and then the component tells Wetel to stop the reply that is still being generated.
For captions and errors, listen for the component’s events: vai-response carries the reply text as soon as it exists, vai-error carries a short code and a message, and vai-ended fires when the conversation is ended on the server side.
What about a hosted video avatar?
Instead of the default 3D avatar drawn in the browser, an agent can be set to a hosted renderer that streams video to your page. It is in limited pilot; your Wetel contact enables it per account. The embed code, attributes and events stay the same, the model setting is ignored, and the voice settings still apply. The agent’s own speech audio is sent to the renderer only to move the face; the conversation logic stays in your workflow.
What does it cost?
Usage is counted in your workspace as credits against your plan’s monthly allowance. Avatar replies drawn in the browser appear in their own usage bucket. Usage of the hosted video avatar is not tracked there yet, so a low avatar figure does not mean low avatar use if an agent runs on the hosted renderer. See what credits are and Pricing & Plans.
What is not built?
- Phone calls. An AI employee cannot receive or place a real phone call today.
- A packaged chat widget. For text-only chat there is a complete working reference page to copy and adapt, not a component.
- A standalone guide to building your own voice pipeline without the avatar component is planned; today the component and its demo are the reference.
- The hosted video avatar is a limited pilot, not generally available.
Whatever the avatar looks like, a person in your workspace chose the agent’s persona and published the workflow it follows, and that is what decides what it may say and do.
Related reference docs
- Avatar & 3D Rendering: the component’s attributes, methods, events and worked example
- Avatar Config: the workspace-wide avatar and voice defaults
- Agents: voice and avatar configuration: the per-agent settings and their limits
- Choosing Languages and Voices: listening languages, alternatives and voice tiers
- Avatar Service REST API: the speech and model-catalog endpoints the component calls
- Core API Flow: starting a conversation from your backend, and the origin allow-list
- Usage buckets: where avatar usage appears
To put your first avatar on a page, start with the avatar component reference.