Skip to main content

Overview

LiveKit Agents provides a realtime framework for voice, video, and physical AI agents. Through our open source integration you can seamlessly add a LemonSlice avatar to real-time voice AI systems.

Quick Start

This section includes a basic usage example and some reference material. For links to more detailed documentation, see Additional resources.

Prerequisites

  1. LemonSlice agent information Either a base image URL or a LemonSlice Agent ID.
    • Agent base image — a publicly accessible image URL of your avatar, focused on the face. The image should be 368 × 560 pixels. LemonSlice will automatically center-crop your image to the target aspect ratio if the dimensions do not match the expected values.
    • LemonSlice Agent ID Note: LiveKit LLM/TTS settings will supersede selected voices and personalities configured for the LemonSlice agent.
  2. LiveKit Agents Python App

Integration Guide

1

Install the plugin

  1. Within your LiveKit Agents app, install the plugin from PyPi:
pip install "livekit-agents[lemonslice]~=1.3"
2

Authenticate

  1. Create a LemonSlice API key
  2. In your LiveKit Agents app, set LEMONSLICE_API_KEY in your .env file
3

Add AvatarSession to AgentSession

In your LiveKit Agents app, create a lemonslice.AvatarSession alongside your AgentSession:
from livekit import agents
from livekit.agents import AgentSession, RoomOutputOptions
from livekit.plugins import lemonslice

async def entrypoint(ctx: agents.JobContext):
await ctx.connect()

session = AgentSession(
    # Add STT, LLM, TTS, and other components here
)

avatar = lemonslice.AvatarSession(
    # Publicly accessible image URL for the avatar
    agent_image_url="...",
    # Prompt to guide the avatar's demeanor
    agent_prompt="Be excited and happy. Use your hands while talking."
)
    
)

# Start the avatar and wait for it to join
await avatar.start(session, room=ctx.room)

# Start your agent session with the user
await session.start(
  # ... room, agent, room_options, etc....
)
Parameters for lemonslice.AvatarSession. Either agent_image_url or agent_id is required.
ParameterDescription
agent_image_urlA URL to an agent image to use.
agent_idThe ID of the LemonSlice agent.
agent_prompt(Optional) A high-level system prompt that subtly influences the avatar’s movements, expressions, and emotional demeanor. This prompt is best used to suggest general affect or demeanor (for example, “feel excited” or “look sad”) rather than precise or deterministic actions.
idle_timeout(Optional) Idle timeout in seconds. Defaults to 60. If a negative number is provided, the session will have no idle timeout.
4

Preview

Preview the avatar in the Agents Playground or a frontend starter app that you build.

Additional resources

The following resources provide more information about using LemonSlice with LiveKit Agents.