adorable-portugal-55771
08/23/2025, 8:49 AMtall-airline-16756
08/23/2025, 8:49 AMtall-airline-16756
08/23/2025, 8:50 AMlk.transcription topic. To fix this, you’ll want to explicitly register a text stream handler in your frontend using room.registerTextStreamHandler. Here’s a little example to get you started:
room.registerTextStreamHandler("lk.transcription", (reader, participantInfo) => {
reader.forEach((chunk) => {
console.log(`Transcription from ${participantInfo.identity}: ${chunk}`);
});
});
On the Python backend side, here’s a snippet using LiveKit Agents 1.0 to handle and send text responses smoothly:
import logging
from dotenv import load_dotenv
from livekit.agents import (
Agent,
AgentSession,
JobContext,
RoomInputOptions,
RoomOutputOptions,
WorkerOptions,
cli,
)
from livekit.plugins import openai
load_dotenv()
logger = logging.getLogger("text-only-agent")
logger.setLevel(logging.INFO)
class MyAgent(Agent):
def __init__(self):
super().__init__(instructions="You are a helpful assistant.")
async def entrypoint(ctx: JobContext):
session = AgentSession(
llm=openai.LLM(model="gpt-4o-mini"),
)
await session.start(
agent=MyAgent(),
room=ctx.room,
room_input_options=RoomInputOptions(text_enabled=True, audio_enabled=False),
room_output_options=RoomOutputOptions(transcription_enabled=True, audio_enabled=False),
)
logger.info("Text-only agent session started.")
if __name__ == "__main__":
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
Just make sure your backend is publishing responses to the lk.transcription topic, and that your frontend has the handler registered to catch and process those messages. If you need any more help with this, I’m here for you!
Sources: packages/livekit-rtc/src/room.ts | src/room/data-stream/incoming/IncomingDataStreamManager.ts | lib/src/core/room.dart | hooks/useDataStreamTranscriptions.ts | Text and transcriptions | LiveKit Docsadorable-portugal-55771
08/23/2025, 8:53 AMtall-airline-16756
08/23/2025, 8:54 AMuseChat hook is here to make handling incoming chat messages super easy for you. It gives you a chatMessages array that updates automatically whenever new messages pop up in the room. Each message comes with handy details like who sent it, what they said, and when.
If it’s not working as expected on your end, it might be because of a few things:
• There could be some hiccups with the data channel connection in your room.
• Messages might be going to a different topic instead of the default chat topic (lk.chat).
• Or maybe there are some custom settings or filters that are changing how messages are handled.
Could you check if the messages are actually being sent to the lk.chat topic and if the data channel is up and running? That info would really help us figure out what’s going on.
Sources: packages/react/src/prefabs/Chat.tsx | Add chat to your React app | LiveKit Docs