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.
Using the Node.js / TypeScript LiveKit framework instead? See the LiveKit Plugin (Node.js) page for the @deepslate-labs/livekit package.
This plugin lives in the deepslate-sdks monorepo. We welcome contributions — feel free to open issues or pull requests there.

Prerequisites

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

Installation

Environment Variables

Set up your credentials as environment variables:
Never expose your Deepslate or ElevenLabs API keys to clients. This plugin is for server-side use with LiveKit Agents.

Quick Start

Configuration Reference

Voice Activity Detection is handled server-side by Deepslate. You tune it via the vad_* parameters on RealtimeModel — no client-side VAD pipeline is needed.
Use a voice cloned and hosted within Deepslate — no external TTS provider credentials required. Pass an instance to RealtimeModel(tts_config=...) to enable audio output.HostedTtsMode values:
Configure server-side text-to-speech with ElevenLabs. Pass an instance to RealtimeModel(tts_config=...) to enable audio output and automatic interruption handling.Use ElevenLabsTtsConfig.from_env() to create a config from environment variables.ElevenLabsVoiceSettingsConfig — fine-grained control over the synthesized voice:
When using ElevenLabs TTS, automatic interruption handling (context truncation) is enabled. The server tracks exactly what was spoken before the interruption, keeping the model’s context accurate. Without server-side TTS, you can use LiveKit’s standard TTS integration, but this interruption context tracking will not be available.

Features

Real-time Voice Streaming

Low-latency bidirectional audio streaming for natural conversations

Server-side VAD

Voice activity detection handled server-side for reliable, configurable speech detection

Function Tools

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

ElevenLabs TTS

Server-side TTS with regional endpoints and fine-grained voice settings

Low Latency Mode

Hosted voice TTS supports a low latency mode for fastest possible response at the cost of some output quality

Direct Speech

Speak text directly via TTS without routing through the LLM

Conversation Queries

Run one-shot side-channel inference without affecting the main conversation

Chat History Export

Export the full conversation history on demand

Live Configuration

Update the system prompt and temperature mid-session without reconnecting

Session Initialized Event

DeepslateRealtimeSession emits a "session_initialized" event once the WebSocket session is fully set up and ready to accept messages.
model.session() is available after AgentSession is created. Register the listener before calling session.start() to avoid missing the event.

Function Tools

Use the @function_tool() decorator to give your agent capabilities:

Direct Speech

speak_direct() lets you synthesize and play audio directly — bypassing the LLM entirely. This is useful for scripted prompts, confirmations, or fallback messages.
Setting include_in_history=False speaks the text without adding it to the conversation context — ideal for system-level announcements.

Conversation Queries

query_conversation() runs a one-shot inference call on a side channel, separate from the main conversational turn. The result is returned as a string and does not affect the conversation history or trigger any audio.
You can also pass instructions to further constrain the model’s output format.

Chat History Export

Export the full conversation history as a list of structured message dicts at any point during a session:
Each message follows the ChatMessageDict structure with role, delivery_status, ephemeral, and a content list of typed content blocks (text, input_audio, tool_call, tool_result, etc.).

Live Configuration

Update the system prompt or temperature mid-session without reconnecting:
Changes take effect on the next model turn.

Contributing

This plugin is open source. Visit the deepslate-sdks monorepo to:
  • Report issues
  • Submit pull requests
  • Request features

Next Steps

WebSocket API

Low-level WebSocket access for custom integrations

API Reference

Full message schemas and configuration options

LiveKit Agents Docs

LiveKit Agents framework documentation

GitHub Repository

Source code, issues, and contributions