I am using livekit sdk on, even though tts never s...
# ask-ai
t
I am using livekit sdk on, even though tts never said that thing, or was about to say something, but didnt say, but llm generated response from ai side, so the text was getting displayed in chat as transcript, even though the tts was not never played, ideally when tts playback start, the transcript should come then only.
t
Thanks for reaching out, Om. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I understand you’re seeing LLM text appear in chat even when the TTS never played, and you want the transcript to show only when audio playback actually starts. Make the agent forward transcripts only during playback by enabling synchronized transcription. Set
sync_transcription=True
in
TextOutputOptions
(or
syncTranscription: true
/
outputOptions.syncTranscription
in JS) so transcripts are sent to the client in alignment with TTS playback. If you need even finer word-by-word sync and your TTS provider supports timings (e.g., Cartesia or ElevenLabs), enable
use_tts_aligned_transcript=True
(Python) to align transcript timing with audio. If you’d like, tell me which SDK (Python or Node) and a short snippet of how you start the agent/room and I’ll show the exact change to make. Sources: Text and transcriptions | LiveKit docs
t
is it something to be managed on livekit frontend sdk ? react sdk ? or through agent.py where we use python ?
t
Good question — configure this on the agent (backend), not in the LiveKit frontend SDK. • Set
sync_transcription=True
in
TextOutputOptions
(Python) or
syncTranscription: true
in the agent
outputOptions
(Node). That makes the agent forward transcripts only when TTS playback occurs. • Optionally enable
use_tts_aligned_transcript=True
(Python) if your TTS provider supports word-level timings for finer sync; the agent will send timing-aligned transcripts the frontend can render word-by-word. If you tell me whether you’re using Python or Node + React, I’ll provide the exact code change you need.
t
so agent sends the transcript to livekit frontend sdk ? means it is not managed by livekit frontend sdk interaction ? right ?
t
You're correct — the agent (backend) manages when transcripts are forwarded. The agent sends transcript events to the LiveKit room only when configured to do so (e.g.,
sync_transcription=True
/
syncTranscription: true
). The LiveKit frontend SDK simply receives those transcript events and displays them; it does not itself decide when to hold or forward LLM-generated text for TTS playback. If you want, tell me whether you're on Python or Node + React and I’ll show the exact agent config and a minimal frontend snippet to consume the synchronized transcript.
t
okayy and where shoul dI write this sync_transcript=True ? when creating the session ? or when running the main file or when exactly ? and under what property
t
Set
sync_transcription=True
when you create the agent session on the backend — i.e., in the code that constructs your AgentSession / room options (not in the frontend). Put it under the text output / output options property. Example (Python) — set it when creating AgentSession / RoomOptions:
Copy code
from livekit.agents import AgentSession, TextOutputOptions, RoomOptions

session = AgentSession(
    # ... other agent/session config ...
    room_options=RoomOptions(
        text_output=TextOutputOptions(
            sync_transcription=True
        )
    )
)
Example (Node) — include in the session/start outputOptions:
Copy code
await session.start({
  agent: new MyAgent(),
  room: ctx.room,
  outputOptions: {
    syncTranscription: true
  },
});
Place this at session/agent initialization (before starting the session). Tell me which language and I’ll show exactly where it fits in your existing file.
t
with latest livekit version will these changes work ?
t
Yes —
sync_transcription
(and the synchronized transcription features) are supported in the latest LiveKit Agents SDK. Set it on the backend when creating/starting your agent session (under
room_options.text_output.sync_transcription
in Python or
outputOptions.syncTranscription
in Node) and it will forward transcripts only during TTS playback. If you tell me whether you use Python or Node + React, I’ll show the exact snippet to add into your current file. Sources: Text and transcriptions | LiveKit docs | Agents v0.x migration guide - Node.js | LiveKit Docs | Agent session | LiveKit docs
t
can you give exact code snippet example for python
t
Below is a minimal Python example showing where to set
sync_transcription=True
when creating/starting an AgentSession so transcripts are forwarded only during TTS playback.
Copy code
from livekit.agents import AgentSession, TextOutputOptions, RoomOptions, MyAgent  # replace MyAgent with your agent

# configure and start the agent session with synchronized transcription
session = AgentSession(
    agent=MyAgent(),
    room_options=RoomOptions(
        text_output=TextOutputOptions(
            sync_transcription=True  # send transcripts only during TTS playback
        )
    ),
)

await session.start()  # or session.start(...) depending on your app flow
If you also use a TTS provider that supports word-level timings and want word-by-word alignment, add
use_tts_aligned_transcript=True
to your AgentSession config. Need that full example integrated into your existing file? Tell me which file/structure you have and I’ll adapt it.
t
Copy code
"livekit-client": "^2.15.8",
    "livekit-server-sdk": "^2.14.0",
are these compatible with livekit - 1.3.6 sdk version ?
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!