Skip to main content

livekit-plugins-meshlite

Give your LiveKit Agents voice agent a lip-synced MeshLite face. Your agent keeps its own speech-to-text, LLM and voice (or realtime model); MeshLite only renders the face, on the visitor's own phone or computer.

your agent (Python)  --lk.audio_stream-->  visitor page (livekit-client)  -->  MeshLite avatar (face + lips)
                     <--playback RPCs----
  • No video server, no GPU, no extra participant in the room: the agent sends its voice to the visitor page over the LiveKit data channel, using the LiveKit Agents avatar data-stream protocol, and the MeshLite web SDK animates the avatar locally.
  • Interruptions work as usual: the face stops at once and reports the position really heard, so the chat context keeps only what the visitor heard.
  • No MeshLite voice minutes are used. The session still counts as a conversation (concurrent conversations, seats, statistics) and lasts at most 2 hours.

Install

pip install livekit-plugins-meshlite

Requires Python 3.9+ and livekit-agents 1.x.

Agent side

from livekit.agents import Agent, AgentSession, JobContext
from livekit.plugins import meshlite

async def entrypoint(ctx: JobContext):
    await ctx.connect()
    session = AgentSession(stt=..., llm=..., tts=...)   # or a realtime model

    avatar = meshlite.AvatarSession()           # visitor_identity="..." if several visitors share the room
    await avatar.start(session, room=ctx.room)  # after ctx.connect(), before session.start()

    await session.start(agent=Agent(instructions="..."), room=ctx.room)

AvatarSession.start() waits for the visitor participant (the first standard participant, or visitor_identity) and replaces the session audio output with LiveKit's DataStreamAudioOutput. The agent then publishes no audio track: its voice reaches the page as data and the MeshLite SDK plays it in sync with the face.

Argument Default Meaning
visitor_identity first standard participant browser participant whose page shows the avatar
sample_rate 24000 PCM rate sent to the page (8000 to 48000)
clear_buffer_timeout 2.0 seconds to wait for the page to confirm an interruption
follow_language True send the language of each agent reply to the page (see below)

Language of the lips

MeshLite computes the lips with one small speech model per language (English, French, Mandarin Chinese). Since 0.2.0, at the end of each agent reply AvatarSession recognises the language of the reply text and, when it changed, tells the page with the RPC meshlite.set_language ({"language": "en" | "fr" | "zh-CN"}). The page (MeshLite web SDK 1.11.62 or later) switches the lip model from the next reply on. Short or ambiguous replies, and other languages, change nothing; an older page answers "unsupported method", which is logged and retried at the next reply.

avatar = meshlite.AvatarSession(follow_language=False)   # keep the session language
await avatar.set_language("en")                          # or force one: "en", "fr", "zh-CN"
avatar.language                                          # last language the page accepted

meshlite.spoken_language_of(text) exposes the detection rule (the same as the MeshLite managed voice): Chinese when at least 4 ideographs make more than 30 % of the letters, otherwise French or English when at least 4 common words lean two to one, else None.

Audio format

One lk.audio_stream byte stream per speech segment: raw 16-bit signed little-endian PCM (usually mono), 24 kHz by default, with sample_rate and num_channels stream attributes. The agent sends the lk.clear_buffer RPC on interruption; the page answers with the lk.playback_started and lk.playback_finished RPCs ({"playback_position": float, "interrupted": bool}).

The data-stream protocol cannot pause and resume a segment. If your agent version offers false-interruption resume, disable it: AgentSession(..., resume_false_interruption=False).

Browser side

You need a MeshLite account on a plan that can embed the SDK on a website, a declared domain, a publishable key and a secret key of the same environment, and an avatar id (all in the MeshLite console).

1. Your server creates the MeshLite session with audio: "livekit". The secret key stays on your server:

const upstream = await fetch("https://console.meshlite.io/api/v1/client-sessions", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.MESHLITE_SECRET_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    publishableKey: process.env.MESHLITE_PUBLISHABLE_KEY,
    origin: "https://www.example.com",   // set by your server, never copied from the browser
    avatar: "your-avatar-id",
    audio: "livekit",
  }),
});
const { sessionToken } = await upstream.json();

2. The visitor page mounts the avatar and attaches the room before connecting:

<div id="avatar" style="width:340px;height:510px"></div>
<script src="https://console.meshlite.io/sdk/1.11.52/meshlite.js" crossorigin="anonymous"></script>
<script type="module">
  import { Room } from "https://cdn.jsdelivr.net/npm/livekit-client@2.23.0/+esm";

  const avatar = MeshLite.mount({
    container: "#avatar",
    avatar: "your-avatar-id",
    publishableKey: "ml_pk_live_...",
    sessionToken,                                  // from your server (step 1)
    audio: "livekit",
  });

  const room = new Room();
  const link = avatar.attachLiveKit(room);         // attach before connect so no speech is missed
  link.on("ready", ({ output }) => console.log("avatar ready, voice played by", output));
  link.on("fallback", ({ code }) => console.warn("avatar unavailable, the voice continues", code));
  link.on("audio-blocked", () => showClickToEnableSound(() => link.resumeAudio()));

  await room.connect(LIVEKIT_URL, participantToken);  // your LiveKit token (data publishing allowed)
  await room.localParticipant.setMicrophoneEnabled(true);
</script>

Requirements: livekit-client 2.9 or later (tested with 2.23.0), MeshLite web SDK 1.11.45 or later, HTTPS (or http://localhost with test keys). Do not subscribe the agent audio yourself: the SDK plays the voice.

attachLiveKit(room, options) accepts agentIdentity (accept audio only from this participant), output ("auto", "frame" or "page") and fallback (default true). With output: "auto", Firefox plays the voice in your page while the avatar animates the lips in silence, so Firefox's echo cancellation hears it; other browsers play it in the avatar frame.

Fallback: the avatar never blocks the conversation

When the face cannot start (refused session, network, timeout), fails, or is stopped (maximum duration, quota), the page plays the agent voice itself from the position already heard, the agent keeps receiving playback events and interruptions, and link emits fallback with an error code. Use fallback: false to stop instead (failed / stopped events).

Limits

  • Maximum session duration: 2 hours.
  • LiveKit recordings (egress) do not contain the agent voice, since no audio track is published.
  • The MeshLite avatar is not a room participant: avatar.avatar_identity on the agent side is the visitor identity.

Example app

examples/browser-avatar is a complete local demo: a LiveKit agent, a small Python server that creates both session tokens, and a page with the avatar. Fill in its .env once, then one command does everything (virtual environment, dependencies, .env check, agent and server together, browser, clean stop on Ctrl+C), on Windows, macOS and Linux:

git clone https://github.com/meshlite-avatar/livekit-plugins-meshlite
cd livekit-plugins-meshlite/examples/browser-avatar
cp .env.example .env     # Windows: copy .env.example .env
# fill in .env: LiveKit, OpenAI (or Azure OpenAI), and your MeshLite test keys and avatar id
python run.py

See its README for the accounts to prepare and what you should see.

Pipecat bots (no LiveKit)

examples/pipecat-browser-avatar gives a Pipecat bot the same face, without LiveKit and without this plugin: the page hands the bot's WebRTC audio track to the MeshLite web SDK with avatar.attachPipecat(client), and the bot itself needs no change. Same single command (python run.py, Python 3.11 or later), with an OpenAI or Azure OpenAI realtime model:

cd livekit-plugins-meshlite/examples/pipecat-browser-avatar
cp .env.example .env     # Windows: copy .env.example .env
# fill in .env: OpenAI (or Azure OpenAI), and your MeshLite test keys and avatar id
python run.py

Step-by-step guide: meshlite.io/docs#pipecat.

Development

pip install -e ".[test]"
pytest

The tests run offline with a fake room and check the exact protocol the MeshLite web SDK implements.

License

Apache-2.0

Metadata

Release files for livekit-plugins-meshlite 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for livekit-plugins-meshlite 0.2.0
File Size Uploaded Provenance Actions
livekit_plugins_meshlite-0.2.0.tar.gz 13.7 kB With provenance Details for livekit_plugins_meshlite-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for livekit-plugins-meshlite 0.2.0
File Interpreter ABI Platform Actions
livekit_plugins_meshlite-0.2.0-py3-none-any.whl Python 3 none any Details for livekit_plugins_meshlite-0.2.0-py3-none-any.whl

Total release size: 29.6 kB

Release files / livekit_plugins_meshlite-0.2.0.tar.gz

Download URL livekit_plugins_meshlite-0.2.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
323b351c81b7673a7cccaff145c0411bde39b28e1cc9b16e8fd0d19f83c58b20
BLAKE2b-256 checksum
How to use checksums
a5da21002d97d4561dee99d588d8893b438bb107759bf29eaf4ef2e7c5296633
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / livekit_plugins_meshlite-0.2.0-py3-none-any.whl

Download URL livekit_plugins_meshlite-0.2.0-py3-none-any.whl
Size 15.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0e09f5c9e317a9bb9d7f4cd444cf54567edd6990a72a97a1e008a75314d2253
BLAKE2b-256 checksum
How to use checksums
821d2250b0c30e43fb85bd6b0b9659f76ed16c17029d9ed12134c1ca2510446d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for livekit-plugins-meshlite 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for livekit_plugins_meshlite-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page