creamy-judge-56458
12/09/2025, 7:57 AMtall-airline-16756
12/09/2025, 7:58 AMtall-airline-16756
12/09/2025, 7:58 AMstt_node, tts_node, and llm_node with realtime models — thanks for the clear question.
No — stt_node, tts_node, and llm_node cannot be used with realtime models. Realtime models consume and produce audio directly and bypass the STT→LLM→TTS pipeline, so those pipeline nodes are not available for realtime models.
If you need customizable STT or TTS behavior, you have two options:
• Use a full STT‑LLM‑TTS pipeline (which supports stt_node, llm_node, and tts_node).
• Keep a realtime model but set responses to text and attach a separate TTS plugin/instance for synthesis (this allows TTS customization but does not expose the pipeline nodes).
Would you like guidance on switching to a pipeline model or configuring a realtime model with a TTS plugin?
Sources: Turn detection and interruptions | LiveKit Docs | Realtime model plugins | LiveKit Docs | Pipeline nodes and hooks | LiveKit docs | Models | LiveKit Docs | Gemini Live API plugin | LiveKit docscreamy-judge-56458
12/09/2025, 8:13 AMtall-airline-16756
12/09/2025, 8:13 AMstt_node or tts_node behavior inside that flow.
Options you can use instead:
• Use the STT‑LLM‑TTS pipeline model to apply stt_node, llm_node, and tts_node for full control.
• Keep a realtime model but set responses to text and run a separate TTS step/plugin for synthesis (this lets you control TTS behavior, but still does not expose internal STT or LLM nodes).
Which option fits your use case — full pipeline control or realtime with external TTS?creamy-judge-56458
12/09/2025, 8:18 AMtall-airline-16756
12/09/2025, 8:18 AMuser_input_transcribed event.
• Agent speech and committed transcription text appear through the conversation_item_added and speech_created events.
• Real‑time frontend delivery uses the lk.transcription text stream topic (clients can register a handler to receive these messages).
• Timing differs for realtime models: transcriptions may be delayed or returned after the agent response because realtime models often don't provide interim results.
• If you need immediate/interim transcriptions, add a separate STT plugin to the AgentSession (this provides real‑time STT while still using a realtime model).
Would you like steps to add an STT plugin or an example showing how to register a lk.transcription handler in your client?
Sources: Realtime model plugins | LiveKit Docs | Agents v0.x migration guide - Node.js | LiveKit Docs | Text and transcriptions | LiveKit docs | Events and error handling | LiveKit docs | Pipeline nodes and hooks | LiveKit docscreamy-judge-56458
12/09/2025, 8:23 AMtall-airline-16756
12/09/2025, 8:23 AMuser_input_transcribed event.
• To modify those transcriptions before they’re committed:
◦ Implement a transcription_node to intercept and transform the transcription stream (this gives you access to the streaming text deltas and lets you yield modified text).
◦ Alternatively, you can read from the lk.transcription text stream on the client and apply post-processing, but transcription_node is the place to alter the canonical transcription that gets written into transcripts.
Would you like a short code example for a transcription_node implementation (Python or TypeScript)?creamy-judge-56458
12/09/2025, 8:27 AMtall-airline-16756
12/09/2025, 8:28 AMtranscription_node example when using a realtime model. Below is a concise Python example showing how to intercept and modify user transcription deltas in an Agent while using an OpenAI Realtime model. It yields cleaned transcription text back into the pipeline so the modified text is what gets written to transcripts.
from typing import AsyncIterable
from livekit.agents import Agent, AgentSession
from livekit.plugins import openai
class MyAssistant(Agent):
async def transcription_node(
self,
text: AsyncIterable[str],
model_settings, # keep typing simple; adapt if you use a specific ModelSettings type
) -> AsyncIterable[str]:
"""
Example transcription_node:
- Receives incremental transcription deltas from the realtime model.
- Cleans / filters text and yields modified deltas back to the pipeline.
"""
async for delta in text:
# simple cleaning example: remove unwanted tokens and trim whitespace
cleaned = delta.replace("❌", "").replace("👍", "").strip()
# example: redact phone numbers (very simple pattern; adapt as needed)
import re
cleaned = re.sub(r"\b\d{3}[-.\s]?\d{3}[-.\s]?\d{4}\b", "[REDACTED_PHONE]", cleaned)
# yield the modified delta so downstream (transcripts, conversation) gets the changed text
yield cleaned
async def on_enter(self, session: AgentSession):
await session.generate_reply(instructions="Greet the user.")
async def run():
# create a realtime LLM model (OpenAI Realtime example)
llm = openai.realtime.RealtimeModel(
voice="alloy",
instructions="You are a helpful assistant."
)
session = AgentSession(
llm=llm,
agent=MyAssistant(),
)
await session.start()
Notes:
• transcription_node receives an AsyncIterable[str] of transcription deltas and must yield strings; yielding modified deltas makes those modifications the canonical text used for transcripts and conversation context.
• Realtime models still emit those transcription streams, so this node works with them. If you need interim/transitional behavior, consider adding a separate STT plugin for faster interim results.
• Adjust cleaning/redaction logic to suit your needs (more robust regexes, language-aware filters, or external PII libraries).
Would you like the same example in TypeScript or a variant that logs deltas with timestamps?
Sources: Events and error handling | LiveKit docs | Pipeline nodes and hooks | LiveKit docs