Skip to main content

Overview

LemonSliceTransport enables your Pipecat bot to join the same virtual room as a LemonSlice avatar and human participants. The transport integrates with the LemonSlice platform to add interactive AI-powered video avatars to Daily rooms. The service handles bidirectional audio streaming, avatar animations, voice activity detection, and conversation interruptions to deliver engaging conversational AI experiences with lifelike visual presence. When used, the Pipecat bot connects to a Daily room alongside the LemonSlice avatar and user. The bot receives audio input from participants, processes it through your pipeline, and sends TTS audio to the LemonSlice avatar for synchronized video rendering.

Installation

To use LemonSlice services, install the required dependency:
pip install "pipecat-ai[lemonslice]"

Prerequisites

LemonSlice Account Setup

Before using LemonSlice video services, you need:
  1. LemonSlice Account: Sign up at LemonSlice Platform
  2. API Key: Generate an API key from your account dashboard
  3. Avatar Selection: Choose from available interactive avatars or provide your own agent image

Required Environment Variables

  • LEMONSLICE_API_KEY: Your LemonSlice API key for authentication

Configuration

LemonSliceTransport

bot_name
str
required
The name of the Pipecat bot instance.
session
aiohttp.ClientSession
required
An aiohttp session for making async HTTP requests to the LemonSlice API.
api_key
str
required
LemonSlice API key for authentication.
session_request
LemonSliceNewSessionRequest
default:"None"
Optional session creation parameters. If not provided, a default agent will be used. See LemonSliceNewSessionRequest below.
params
LemonSliceParams
default:"LemonSliceParams()"
Transport configuration parameters. See LemonSliceParams below.
input_name
str
default:"None"
Optional name for the input transport processor.
output_name
str
default:"None"
Optional name for the output transport processor.

LemonSliceNewSessionRequest

Configuration for creating a new LemonSlice session.
agent_image_url
str
default:"None"
URL to an agent image. Provide either agent_id or agent_image_url, not both.
agent_id
str
default:"None"
ID of a LemonSlice agent. Provide either agent_id or agent_image_url, not both. If neither is provided, a default agent will be used.
agent_prompt
str
default:"None"
A high-level system prompt that subtly influences the avatar’s movements, expressions, and emotional demeanor.
idle_timeout
int
default:"None"
Idle timeout in seconds for the session.
daily_room_url
str
default:"None"
Daily room URL to use for the session. If not provided, LemonSlice will create a new room.
daily_token
str
default:"None"
Daily token for authenticating with the room.
lemonslice_properties
dict
default:"None"
Additional properties to pass to the LemonSlice session.

LemonSliceParams

Inherits from DailyParams (which inherits from TransportParams) with the following defaults:
audio_in_enabled
bool
default:"True"
Whether to enable audio input from participants.
audio_out_enabled
bool
default:"True"
Whether to enable audio output to participants.
microphone_out_enabled
bool
default:"False"
Whether to enable microphone output track.

Usage

LemonSliceTransport creates a three-way conversation between your Pipecat bot, a LemonSlice avatar, and human participants. The transport manages the LemonSlice API session and Daily room connectivity automatically. See the complete example for a full implementation including:
  • LemonSlice transport configuration with API key and session setup
  • Avatar selection and configuration
  • Pipeline integration with TTS
  • Event handling for participant management

Event Handlers

LemonSliceTransport provides event handlers for participant connection lifecycle. Register handlers using the @event_handler decorator on the transport instance.

Events Summary

EventDescription
on_client_connectedParticipant (non-avatar) connected to the session
on_client_disconnectedParticipant (non-avatar) disconnected from the session
The LemonSlice avatar participant is automatically filtered out from these events. Only human participant connections trigger the event handlers.

Connection Lifecycle

on_client_connected

Fired when a human participant connects to the session. The LemonSlice avatar is filtered out from this event.
@transport.event_handler("on_client_connected")
async def on_client_connected(transport, participant):
    print(f"Client connected: {participant}")
Parameters:
ParameterTypeDescription
transportLemonSliceTransportThe transport instance
participantMapping[str, Any]The participant data

on_client_disconnected

Fired when a human participant disconnects from the session.
@transport.event_handler("on_client_disconnected")
async def on_client_disconnected(transport, participant):
    print(f"Client disconnected: {participant}")
Parameters:
ParameterTypeDescription
transportLemonSliceTransportThe transport instance
participantMapping[str, Any]The participant data

Notes

  • LemonSlice uses Daily as the underlying transport layer, so all Daily features and configuration options are available through the inherited DailyParams.
  • The transport automatically manages interruptions and sends appropriate control messages (interrupt, response_started, response_finished) to the LemonSlice session.
  • The LemonSlice avatar’s microphone is automatically muted to prevent audio feedback loops.

Additional Resources