-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I'm building a custom voice agent using the LiveKit Agents Python SDK. Audio and TTS work correctly, but transcription events are not being received on the frontend client (listening to "lk.transcription" stream). I'm setting text_enabled=True, but no text events arrive.
Environment:
- livekit-agents version: 1.0.0
- Backend language: Python
- Frontend: React Native with @livekit/react-native v2.7.4
- STT: Deepgram
- LLM: OpenAI
- TTS: Cartesia
- VAD: Silero
Backend code (simplified):
from livekit.agents import JobContext, WorkerOptions, cli
from livekit.agents.voice import Agent, AgentSession
from livekit.plugins import silero, deepgram, openai, cartesia
class MyAgent(Agent):
def __init__(self, instructions, vad_model):
super().__init__(
instructions=instructions,
stt=deepgram.STT(),
llm=openai.LLM(model="gpt-4o-mini-2024-07-18"),
tts=cartesia.TTS(model="sonic", sample_rate=44100),
vad=vad_model,
text_enabled=True # Explicitly enabling text
)
async def entrypoint(ctx: JobContext):
await ctx.connect()
await ctx.wait_for_participant()
vad = await silero.VAD.load()
agent = MyAgent("You are a helpful assistant.", vad_model=vad)
session = AgentSession()
await session.start(agent=agent, room=ctx.room)
await session.say("Hello! I am ready.")
Frontend code (React Native):
tsx
// In Messages component
useEffect(() => {
if (!room || room.state !== "connected") return;
console.log("✅ Room connected, registering text stream handler");
room.registerTextStreamHandler(
"lk.transcription",
async (reader, participantInfo) => {
const msg = await reader.readAll();
console.log("📩 transcription:", msg);
// Add message to UI
addMessage({
text: msg,
isLocalParticipant: false,
});
}
);
}, [room?.state]);
Issues:
Audio and responses from the agent work fine
No lk.transcription events are received
No logs or errors shown in agent or frontendMetadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working