refined-energy-76161
09/16/2025, 8:21 PMtall-airline-16756
09/16/2025, 8:21 PMtall-airline-16756
09/16/2025, 8:21 PMconst text = "Hello, how are you?";
const info = await room.localParticipant.sendText(text, {
topic: 'lk.chat',
});
console.log(`Sent text with stream ID: ${info.id}`);
Agent (Python):
from livekit.agents import AgentSession, JobContext
from livekit.plugins import openai
async def entrypoint(ctx: JobContext):
session = AgentSession(llm=openai.LLM(model="gpt-4o-mini"))
await session.start(
room=ctx.room,
room_input_options=RoomInputOptions(text_enabled=True),
room_output_options=RoomOutputOptions(transcription_enabled=True),
)
await session.generate_reply(user_input="Hi, can you help me?")
Frontend (Receiving Response):
room.registerTextStreamHandler('lk.transcription', async (reader) => {
const message = await reader.readAll();
console.log(`Avatar response: ${message}`);
});
If you have any questions or need more examples, please don’t hesitate to ask. I’m here to help you every step of the way!
Sources: Text and transcriptions | LiveKit Docs | Sending text | LiveKit Docs | README.md | examples/avatar_agents/tavus/agent_worker.py | Docs::Agents