# Best Live Avatar integration examples

These backend adapters add LemonSlice video to an existing voice pipeline. They accept already configured voice services, so they do not choose an STT, LLM, TTS, or model provider.

- `livekit_lemonslice.py`: connect an existing LiveKit AgentSession and own avatar startup and cleanup.
- `pipecat_lemonslice.py`: assemble an existing Pipecat pipeline around LemonSliceTransport over Daily.
- `server-env.example.txt`: server-side placeholders only. Load your own environment in your backend before calling `AvatarConfig.from_environment()`.

The live integration calls require your own authorized accounts, keys, transport, avatar image, and voice pipeline. Running them can consume provider credits. The examples themselves have no command that automatically starts a live call.

## Reproduce the offline checks

Run these commands from this directory. Use separate environments because the frameworks have different dependency requirements.

```sh
python3.12 -m venv .venv-livekit
.venv-livekit/bin/python -m pip install -r requirements-livekit.txt
.venv-livekit/bin/python -m unittest test_livekit_offline.py -v

python3.12 -m venv .venv-pipecat
.venv-pipecat/bin/python -m pip install -r requirements-pipecat.txt
.venv-pipecat/bin/python -m unittest test_pipecat_offline.py -v
```

Verified on October 13, 2026 with Python 3.12.14, macOS ARM64:

| Example | Installed versions | Checks |
| --- | --- | --- |
| LiveKit | livekit-agents 1.8.6, livekit-plugins-lemonslice 1.8.6 | 5 passed |
| Pipecat | pipecat-ai 1.12.0, daily-python 0.34.0 | 4 passed |

The checks exercise installed SDK imports, constructor/method contracts, actual object construction, and local lifecycle/pipeline fixtures. HTTP and Python socket connections are blocked during tests. The Pipecat worker is never run. They do not validate provider HTTP requests, live room joins, browser media permissions, microphones, STT/LLM/TTS output, generated avatar video, lip sync, or production cost reconciliation.

## LiveKit usage

Copy `livekit_lemonslice.py` into your existing backend. Inside your AgentServer job, use its already configured context, session, and agent:

```python
from livekit_lemonslice import AvatarConfig, start_avatar

avatar = await start_avatar(ctx, session, agent, AvatarConfig.from_environment())
```

The adapter connects to the room, registers an avatar shutdown callback, starts the avatar with a finite startup timeout, then starts your voice agent. Wait for a frontend video track or the provider's `bot_ready` event before displaying ready status. Use the normal JobContext shutdown path when your user leaves.

## Pipecat usage

Copy `pipecat_lemonslice.py` into your existing backend. Pass configured processors from your current bot:

```python
from pipecat_lemonslice import AvatarConfig, run_avatar_pipeline

await run_avatar_pipeline(
    AvatarConfig.from_environment(),
    stt=stt,
    user_aggregator=user_aggregator,
    llm=llm,
    tts=tts,
    assistant_aggregator=assistant_aggregator,
)
```

This adapter requires an existing Daily room and room-scoped bot token. Your frontend joins that same room with its own short-lived token. Human and avatar disconnect events cancel the worker. Transport cleanup ends the provider session. Keep the provider key on the backend.

## Official references

- [LemonSlice LiveKit](https://lemonslice.com/docs/livekit)
- [LiveKit LemonSlice plugin](https://docs.livekit.io/agents/models/avatar/plugins/lemonslice/)
- [LiveKit Python plugin API](https://docs.livekit.io/reference/python/livekit/plugins/lemonslice/index.html)
- [LemonSlice Pipecat](https://lemonslice.com/docs/pipecat)
- [Pipecat LemonSlice transport](https://docs.pipecat.ai/api-reference/server/services/transport/lemonslice)
- [Official Pipecat example](https://github.com/pipecat-ai/pipecat/blob/main/examples/video-avatar/video-avatar-lemonslice-transport.py)

The Best Live Avatar adapters and offline tests are original examples informed by these references. Recheck provider documentation when upgrading pins.
