Overview

LiveKitTransport provides real-time audio communication capabilities using LiveKit’s open-source WebRTC platform. It supports bidirectional audio streaming, data messaging, participant management, and room event handling for conversational AI applications with the flexibility of self-hosted or cloud infrastructure.

Installation

To use LiveKitTransport, install the required dependencies:
pip install "pipecat-ai[livekit]"

Prerequisites

LiveKit Setup

Before using LiveKitTransport, you need:
  1. LiveKit Server: Set up self-hosted or use LiveKit Cloud
  2. API Credentials: Generate API key and secret from your LiveKit project
  3. Room Management: Create rooms using LiveKit API or SDK
  4. Access Tokens: Generate JWT tokens for room authentication

Required Environment Variables

  • LIVEKIT_API_KEY: Your LiveKit API key for authentication
  • LIVEKIT_API_SECRET: Your LiveKit API secret for token generation
  • LIVEKIT_URL: Your LiveKit server URL (wss://your-domain.livekit.cloud)

Key Features

  • Open Source: Self-hosted or cloud-hosted WebRTC infrastructure
  • Multi-participant Support: Handle multiple participants in rooms
  • Data Channels: Real-time messaging alongside audio streams
  • Room Management: Dynamic participant and room lifecycle management
  • Flexible Deployment: Self-hosted or managed cloud options

Usage

LiveKitTransport connects your Pipecat bot to LiveKit rooms where it can communicate with participants through audio and data channels. The transport handles room joining, participant events, and media streaming automatically. See the complete example for a full implementation including:
  • LiveKit room creation and token generation
  • Transport configuration with participant management
  • Pipeline integration with audio processing
  • Event handling for room lifecycle management