red-agent-48266
09/13/2025, 1:35 PMtall-airline-16756
09/13/2025, 1:35 PMtall-airline-16756
09/13/2025, 1:36 PM@livekit/agent-js
package does include voice functionality! It comes with a dedicated voice
module designed to help you build voice-based AI agents, featuring capabilities like speech-to-text (STT), text-to-speech (TTS), voice activity detection (VAD), and even integration with Large Language Models (LLM) for smooth conversational AI experiences.
Here are some key components to know about:
• voice.Agent
: This lets you define agents with STT, TTS, LLM, and VAD configurations tailored to your needs.
• voice.AgentSession
: It manages the lifecycle of a voice agent within a LiveKit room, keeping things running smoothly.
• Support for popular third-party STT and TTS services like Deepgram, ElevenLabs, and Google, giving you flexibility.
• Turn detection and real-time audio processing to make your conversations interactive and natural.
If you'd like, I’m here to help you set up or guide you through using any of these features—just let me know!
Sources: examples/src/cartersia_tts.ts | Agent speech and audio | LiveKit Docsred-agent-48266
09/13/2025, 1:42 PMtall-airline-16756
09/13/2025, 1:43 PM@livekit/agent-js
in TypeScript:
1. Define the Agent: Start by using the defineAgent
function to create an entrypoint. This will also prewarm important resources like the Voice Activity Detection (VAD) model to get things ready:
export default defineAgent({
prewarm: async (proc) => {
proc.userData.vad = await silero.VAD.load();
},
entry: async (ctx) => {
// Agent setup and room connection happens here
},
});
1. Set Up the Voice Agent: Next, create the agent with clear instructions and tools to make it friendly and effective:
const agent = new voice.Agent({
instructions: 'You are a friendly voice assistant built by LiveKit.',
});
1. Create and Start the Agent Session: Here, you’ll use the prewarmed VAD and other components to get the session going:
const session = new voice.AgentSession({
vad: ctx.proc.userData.vad,
stt: new deepgram.STT(),
llm: new openai.LLM(),
tts: new elevenlabs.TTS(),
turnDetection: new livekit.turnDetector.MultilingualModel(),
});
await session.start({
agent,
room: ctx.room,
});
1. Connect to the Room: Finally, join the LiveKit room as a participant and greet users warmly:
await ctx.connect();
session.say('Hello, how can I help you today?');
If you have any questions or would like a complete example, please don’t hesitate to ask—I’m here to help!
Sources: examples/src/drive-thru/drivethru_agent.tsred-agent-48266
09/13/2025, 1:43 PMtall-airline-16756
09/13/2025, 1:44 PM@livekit/agent-js
for TypeScript, you can use this simple line:
import { voice } from '@livekit/agents';
This will give you access to important components like Agent
and AgentSession
, which are great for building voice-enabled agents.
Just make sure you have the necessary dependencies installed by running:
npm install @livekit/agents
npm install @livekit/agents-plugin-openai @livekit/agents-plugin-deepgram @livekit/agents-plugin-elevenlabs @livekit/agents-plugin-silero
If you have any questions or would like some examples to guide you further, please don’t hesitate to ask—I’m here to help!
Sources: Docs::Agents | agents/src/voice/room_io/index.tsred-agent-48266
09/13/2025, 1:45 PMtall-airline-16756
09/13/2025, 1:45 PMvoice
module might not be directly exported in the version of @livekit/agents
you're using. Could you please share the exact version of the package you have installed? Also, are you running into any specific errors or challenges when trying to use the voice-related features?
Knowing this will really help me guide you better and suggest the best possible solutions.red-agent-48266
09/13/2025, 1:46 PMtall-airline-16756
09/13/2025, 1:46 PM