Skip to main content
The deepslate-livekit package provides a RealtimeModel implementation for the LiveKit Agents framework, enabling seamless integration with Deepslate’s unified voice AI infrastructure.
This plugin is in early development. We welcome contributions! See the GitHub repository to get involved.

Prerequisites

  • A Deepslate account with API credentials
  • Python 3.11+
  • LiveKit server and API credentials
  • (Optional) ElevenLabs API key for server-side TTS

Installation

pip install git+https://github.com/rooms-solutions/deepslate-livekit.git

Environment Variables

Set up your credentials as environment variables:
VariableRequiredDescription
DEEPSLATE_VENDOR_IDYesYour Deepslate vendor ID
DEEPSLATE_ORGANIZATION_IDYesYour Deepslate organization ID
DEEPSLATE_API_KEYYesYour Deepslate API key
ELEVENLABS_API_KEYNoElevenLabs API key for TTS
ELEVENLABS_VOICE_IDNoElevenLabs voice ID
ELEVENLABS_MODEL_IDNoElevenLabs model (e.g., eleven_turbo_v2)
Never expose your Deepslate or ElevenLabs API keys to clients. This plugin is for server-side use with LiveKit Agents.

Quick Start

from livekit import agents
from livekit.agents import AgentServer, AgentSession, Agent, room_io

import deepslate.livekit.realtime
from deepslate.livekit.realtime import ElevenLabsTtsConfig

class Assistant(Agent):
    def __init__(self) -> None:
        super().__init__(instructions="You are a helpful voice AI assistant.")

server = AgentServer()

@server.rtc_session()
async def my_agent(ctx: agents.JobContext):
    session = AgentSession(
        llm=deepslate.livekit.realtime.RealtimeModel(
            tts_config=ElevenLabsTtsConfig.from_env()
        ),
    )

    await session.start(
        room=ctx.room,
        agent=Assistant(),
        room_options=room_io.RoomOptions(),
    )

    await session.generate_reply(
        instructions="Greet the user and offer your assistance."
    )

if __name__ == "__main__":
    agents.cli.run_app(server)

Configuration Reference

ParameterTypeDefaultDescription
vendor_idstrenv: DEEPSLATE_VENDOR_IDDeepslate vendor ID
organization_idstrenv: DEEPSLATE_ORGANIZATION_IDDeepslate organization ID
api_keystrenv: DEEPSLATE_API_KEYDeepslate API key
base_urlstrhttps://app.deepslate.euBase URL for Deepslate API
system_promptstr"You are a helpful assistant."System prompt for the model
generate_reply_timeoutfloat30.0Timeout in seconds for generate_reply (0 = no timeout)
tts_configElevenLabsTtsConfigNoneTTS configuration (enables audio output)
Voice Activity Detection settings control how the server detects when the user starts and stops speaking.
ParameterTypeDefaultDescription
vad_confidence_thresholdfloat0.5Minimum confidence to consider audio as speech (0.0-1.0)
vad_min_volumefloat0.01Minimum volume threshold (0.0-1.0)
vad_start_duration_msint200Duration of speech to detect start (ms)
vad_stop_duration_msint500Duration of silence to detect end (ms)
vad_backbuffer_duration_msint1000Audio buffer before speech detection (ms)
Configure server-side text-to-speech with ElevenLabs.
ParameterTypeDescription
api_keystrElevenLabs API key (env: ELEVENLABS_API_KEY)
voice_idstrVoice ID (env: ELEVENLABS_VOICE_ID)
model_idstr | NoneModel ID, e.g., eleven_turbo_v2 (env: ELEVENLABS_MODEL_ID)
Use ElevenLabsTtsConfig.from_env() to create a config from environment variables.
When using ElevenLabs TTS, automatic interruption handling (context truncation) is enabled. Without server-side TTS, you can use LiveKit’s standard TTS integration, but interruption handling will not work.

Features

Real-time Voice Streaming

Low-latency bidirectional audio streaming for natural conversations

Server-side VAD

Voice activity detection handled server-side for reliable speech detection

Function Tools

Define and use function tools with the @function_tool() decorator

ElevenLabs TTS

Server-side text-to-speech with automatic interruption handling

Function Tools

Use the @function_tool() decorator to give your agent capabilities:
from livekit.agents import function_tool

@function_tool()
def get_weather(location: str) -> str:
    """Get the current weather for a location.

    Args:
        location: The city or location to get weather for
    """
    # Your implementation here
    return f"The weather in {location} is sunny and 22°C"

class WeatherAssistant(Agent):
    def __init__(self) -> None:
        super().__init__(
            instructions="You are a helpful weather assistant.",
            tools=[get_weather]
        )

Contributing

This plugin is open source and we welcome contributions. Visit the GitHub repository to:
  • Report issues
  • Submit pull requests
  • Request features

Next Steps