enough-match-43171
12/18/2025, 10:43 AMtall-airline-16756
12/18/2025, 10:43 AMtall-airline-16756
12/18/2025, 10:44 AMsay() method. This generates speech, adds the text to the transcript, and updates chat context.
Example:
await session.say("Hello, how can I help you today?", allow_interruptions=False)
• allow_interruptions controls whether the user can interrupt the agent while it speaks.
2) Plain text-only chat message
• Use the room participant send_text() to post text to the chat topic (e.g., lk.chat):
await ctx.room.local_participant.send_text("Your message here", topic="lk.chat")
Notes
• Ensure text input is enabled for the agent (do not disable it in RoomOptions).
• Agents receive chat messages on the lk.chat topic and can process them via the room's text handlers.
Would you like a full example file for a Python agent that sends both kinds of messages?
Sources: Text and transcriptions | LiveKit docs | Agent speech and audio | LiveKit docs | Sending text | LiveKit docsenough-match-43171
12/18/2025, 10:44 AMtall-airline-16756
12/18/2025, 10:45 AMlk.chat. The agent will receive them, interrupt if needed, and generate replies automatically.
• Custom handling with a text input callback
◦ Provide TextInputOptions.text_input_cb when starting the session to run your own handler. In the handler you can:
▪︎ Read event.text
▪︎ Apply filters or command handling
▪︎ Call session.say(...) to speak + add to chat, or session.generate_reply(user_input=...) / session.interrupt() to trigger the agent reply
▪︎ Or use session.interrupt() then session.generate_reply(user_input=message) for default-style responses
Example callback (conceptual):
def custom_text_input_handler(session: AgentSession, event: room_io.TextInputEvent):
msg = event.text
if msg.startswith("/help"):
await session.say("Available commands: /help, /status")
return
# filter example
if "spam" in msg.lower():
await session.say("I can't respond to that.")
return
# default behavior: interrupt and generate reply
session.interrupt()
await session.generate_reply(user_input=msg)
How to set it when starting the session:
await session.start(
agent=Agent(instructions="You are a helpful assistant."),
room=ctx.room,
room_options=room_io.RoomOptions(
text_input=room_io.TextInputOptions(text_input_cb=custom_text_input_handler)
)
)
If you'd like, I can:
• Provide a complete runnable Python example that includes AgentSession setup, the callback, and sending a test message.
• Or show how to send messages from a client so the agent receives them. Which would help more? Sources: Text and transcriptions | LiveKit docsenough-match-43171
12/18/2025, 10:46 AMtall-airline-16756
12/18/2025, 10:46 AMuseTracks, VideoRenderer, etc.) and don't include any chat/text components. The agent-starter templates expose a supportsChatInput flag you can disable.
• If you have a custom frontend, simply don't render any UI that shows or sends messages to the lk.chat topic.
• If you want to disable chat entirely (not just hide it), stop calling sendText() from participants and don’t register text handlers on the client.
Which UI framework or component are you using (React, Flutter, plain JS, mobile)? I’ll give a short code example for that environment.
Sources: Text and transcriptions | LiveKit docs | Sending text | LiveKit docs | Examples | livekit/livekit_composite | DeepWiki