how to run livekit in chat mode only i.e it should...
# ask-ai
e
how to run livekit in chat mode only i.e it should not use stt and tts
t
Thanks for reaching out, Aman. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — your goal is to run LiveKit Agents in chat-only mode (no STT and no TTS). You can do that by disabling audio input and output when starting the AgentSession so all communication happens via text. Here are concise examples and key notes to get you running: 1) Python (AgentSession)
Copy code
from livekit.agents import AgentSession
from livekit.agents.voice import room_io

await session.start(
    agent=MyAgent(),
    room=ctx.room,
    room_options=room_io.RoomOptions(
        audio_input=False,   # disable STT
        audio_output=False,  # disable TTS
        text_input=True,     # enable text input
        text_output=True,    # enable text output
    ),
)
2) Node.js (AgentSession)
Copy code
await session.start({
    agent: new MyAgent(),
    room: ctx.room,
    inputOptions: {
        audioEnabled: false, // disable STT
        textEnabled: true,   // enable text input
    },
    outputOptions: {
        audioEnabled: false, // disable TTS
        transcriptionEnabled: true, // enable text output
    },
});
3) Receiving agent text responses • When audio output is disabled, agent responses are published to the
lk.transcription
text stream topic (they will not include a
lk.transcribed_track_id
attribute). Your client must listen to that stream to receive agent responses. • Example (JS):
Copy code
room.registerTextStreamHandler('lk.transcription', async (reader, participantInfo) => {
  const message = await reader.readAll();
  const isTranscription = reader.info.attributes['lk.transcribed_track_id'] != null;
  if (!isTranscription) {
    console.log(`Agent response from ${participantInfo.identity}: ${message}`);
  }
});
Key notes and tips • The LiveKit console/playground uses legacy transcription events and will not show responses when audio output is disabled. Use a custom receiver/client to see text-only responses. • You can toggle audio on/off during a live session with
session.input.set_audio_enabled()
and
session.output.set_audio_enabled()
if you want hybrid behavior later. • Ensure your frontend sends user text to the
lk.chat
topic and listens on
lk.transcription
for agent replies. If you want, tell me: • Which SDK or language you’re using (web/JS, Node, Python, or mobile), and • Whether you need a complete client example for sending/receiving the chat messages. I’ll provide the next steps or a tailored snippet. Sources: Text and transcriptions | LiveKit Documentation | How to build an agent with speech-to-text input and text-only output | Live...
e
so i have to also make changes to frontend or is this already ahandled in agent-starter-react code
t
Thanks — I’m responding to whether you need to change your frontend (agent-starter-react) to run LiveKit in chat-only mode. Short answer: most likely yes — you’ll need to ensure the frontend disables audio tracks and listens/sends the correct text streams. The starter app may include helpers, but it won’t automatically switch to a pure chat-only flow without configuration. A few quick checks and next steps: 1) Which repo/version are you using? • Tell me if you’re using the official agent-starter-react repo or a fork, and which commit or release (if known). That helps me give precise instructions. 2) Check these areas in your frontend: • Audio publication: Ensure the client does not publish microphone audio tracks (remove or stop getUserMedia audio, or call
setAudioEnabled(false)
if such helper exists). • Audio subscription/output: Ensure you don’t create audio elements for agent audio or call any TTS playback code. • Text sending: Confirm the frontend sends user messages to the
lk.chat
text stream/topic. • Text receiving: Confirm the frontend registers a handler for
lk.transcription
(and filters out transcriptions that come from actual audio if needed) to display agent responses. 3) What to change if needed (high level) • Disable or skip microphone capture and audio publishing when starting the room/session. • Stop any code that plays remote audio (TTS) from agent tracks. • Add/verify text stream publish for user messages (
lk.chat
) and register a text stream handler for
lk.transcription
to receive agent replies. • If the starter app uses the LiveKit console’s legacy transcription events, replace or augment that with a
registerTextStreamHandler
that reads
lk.transcription
messages. 4) I can provide concrete edits • If you tell me which file(s) you see in the starter app (e.g., where it calls
connect
, where it captures mic, or a component named like
AudioController
/
TextChat
), I’ll give exact code snippets to: ◦ disable audio publish, ◦ stop TTS playback, ◦ publish text messages to
lk.chat
, and ◦ register the
lk.transcription
handler to show agent replies. Which repo/version and which frontend files can you share? I’ll give the exact changes you need.
e
i checked it's handled in agent-starter-react
t
Great — thanks for checking. Since agent-starter-react already handles chat-only mode, here’s a concise confirmation and a couple of practical notes to make sure everything behaves as you expect. What’s handled • The starter app can run with audio disabled so the agent and user communicate via text only. • When audio output is disabled, agent responses are published to the
lk.transcription
text stream (without a
lk.transcribed_track_id
), and the starter app reads those messages for display. Quick things to verify in your running app • Microphone is not published: confirm the app either doesn’t call getUserMedia for audio or sets audio publishing to false. • TTS playback is not triggered: confirm the app won’t create audio elements or invoke any TTS playback code when audio output is disabled. • Sending text: the frontend publishes user messages to
lk.chat
. • Receiving agent replies: the frontend registers a handler for
lk.transcription
and displays messages that are not audio transcriptions. Tips and gotchas • The LiveKit console/playground uses legacy transcription events and won’t show text-only responses; use your app UI to view agent replies. • If you want to toggle between voice and chat modes, the starter app supports toggling audio at runtime via the session input/output audio enable APIs — verify those controls behave as expected. • If you ever see empty responses, check that the
lk.transcription
handler is filtering correctly for non-transcribed messages (i.e., messages without
lk.transcribed_track_id
). If you’d like, I can: • Point to the exact file(s) in your agent-starter-react copy to review, or • Provide a small code snippet to double-check the
lk.transcription
handler and the text-publish flow. Which would you prefer?