From your AgentSession to spoken audio.

Install the documented Python or TypeScript plugin and add LiveKit credentials and an elbic API key. Use the example to make your agent read one opening line.

Set up your first test.

Connect the TTS provider
Pass the elbic plugin to AgentSession with the voice ID and API credentials. The rest of your session handles when users speak and where replies go.
Warm the connection
Prewarm during setup to reuse one WebSocket across turns. Test the first reply and a later reply in the same session.
Check an interruption
If you use word timestamps or barge-in, test what happens when someone speaks during playback.

Code

Run one LiveKit turn.

Install with pip install "kugelaudio[livekit]" or npm install kugelaudio. The worker reads KUGELAUDIO_API_KEY and the LiveKit credentials from the environment.

Python
from livekit.agents import Agent, AgentSession, JobContext
from livekit.agents import WorkerOptions, cli
from livekit.plugins import openai, silero
from kugelaudio.livekit import STT as KugelAudioSTT
from kugelaudio.livekit import TTS as KugelAudioTTS

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

    tts = KugelAudioTTS(model="kugel-3.5", voice_id=1071, language="en")
    tts.prewarm()

    session = AgentSession(
        stt=KugelAudioSTT(language="en"),
        turn_handling={"turn_detection": "stt"},
        llm=openai.LLM(model="gpt-4o-mini"),
        tts=tts,
        vad=silero.VAD.load(),
    )
    await session.start(
        room=ctx.room,
        agent=Agent(instructions="You are a helpful voice assistant."),
    )
    await session.say("Hello! How can I help you?")

if __name__ == "__main__":
    cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
TypeScript
import { fileURLToPath } from 'node:url';
import { WorkerOptions, cli, defineAgent, voice } from '@livekit/agents';
import * as openai from '@livekit/agents-plugin-openai';
import * as silero from '@livekit/agents-plugin-silero';
import { STT as KugelAudioSTT, TTS as KugelAudioTTS } from 'kugelaudio/livekit';

export default defineAgent({
  entry: async (ctx) => {
    await ctx.connect();

    const tts = new KugelAudioTTS({
      model: 'kugel-3.5',
      voiceId: 1071,
      language: 'en',
    });
    tts.prewarm();

    const session = new voice.AgentSession({
      stt: new KugelAudioSTT({ language: 'en' }),
      turnHandling: { turnDetection: 'stt' },
      llm: new openai.LLM({ model: 'gpt-4o-mini' }),
      tts,
      vad: await silero.VAD.load(),
    });
    await session.start({
      agent: new voice.Agent({
        instructions: 'You are a helpful voice assistant.',
      }),
      room: ctx.room,
    });
    await session.say('Hello! How can I help you?');
  },
});

cli.runApp(new WorkerOptions({ agent: fileURLToPath(import.meta.url) }));

Copied from the documentation at docs.kugelaudio.com/integrations/livekit. Read the full guide

Before your first test.

Do I need a LiveKit project?

Yes. Use the LiveKit credentials referenced in the example and a key for the speech API.

Is the recording a timing measurement?

It demonstrates how the TTS model reads a script. Measure the time to first audio in your own LiveKit session.

Run one LiveKit turn.

Follow the documented setup, then listen to the output with a script from your application.

Contact sales

Tell us what you’re building.

or write a message