aloof-scooter-47164
12/06/2025, 10:47 PMtall-airline-16756
12/06/2025, 10:47 PMtall-airline-16756
12/06/2025, 10:47 PM@session.on("user_input_transcribed")
def on_user_input_transcribed(event: UserInputTranscribedEvent):
logger.info(f"User: {event.transcript} (final={event.is_final})")
• Node:
session.on(voice.AgentSessionEventTypes.UserInputTranscribed, (event) => {
console.log(`User transcript: ${event.transcript}, final: ${event.isFinal}`);
});
2) Log completed messages committed to chat history
• Listen for conversation_item_added to capture full messages (user or agent) when they’re saved to the conversation.
◦ Python:
@session.on("conversation_item_added")
def on_conversation_item_added(event: ConversationItemAddedEvent):
logger.info(f"{event.item.role}: {event.item.text_content}")
• Node:
session.on(voice.AgentSessionEventTypes.ConversationItemAdded, (event) => {
console.log(`${event.item.role}: ${event.item.textContent}`);
});
3) (Advanced) Capture streaming/word-level transcripts from the agent
• Implement a transcription_node in your agent to receive timed chunks or word-level transcripts as they’re generated. Useful for fine-grained logging or aligning audio with text.
◦ Python example:
async def transcription_node(self, text: AsyncIterable[str | TimedString], model_settings: ModelSettings) -> AsyncGenerator[str | TimedString, None]:
async for chunk in text:
if isinstance(chunk, TimedString):
logger.info(f"Transcribed (timed): '{chunk}' at {chunk.start_time}s")
else:
logger.info(f"Transcribed: {chunk}")
yield chunk
Notes
• Use user_input_transcribed for real-time user speech, conversation_item_added for finalized messages, and transcription_node when you need timed/word-level streaming from the agent.
• Ensure your SDK version supports these events/features and that observability is enabled for your project.
Would you like sample code for your specific SDK (Python or Node) or guidance on where to write these logs (console, file, external logger)?
Sources: Text and transcriptions | LiveKit docs | How to capture real-time agent transcriptions during conversations | Agent insights in LiveKit Cloud | LiveKit docsaloof-scooter-47164
12/06/2025, 10:49 PMtall-airline-16756
12/06/2025, 10:49 PM@session.on("conversation_item_added")
def on_conversation_item_added(event: ConversationItemAddedEvent):
logger.info(f"{event.item.role}: {event.item.text_content}")
• Node:
session.on(voice.AgentSessionEventTypes.ConversationItemAdded, (event) => {
console.log(`${event.item.role}: ${event.item.textContent}`);
});
2) If you must use transcription events, filter for final transcripts only
• Listen to user_input_transcribed and check is_final before logging.
◦ Python:
@session.on("user_input_transcribed")
def on_user_input_transcribed(event: UserInputTranscribedEvent):
if event.is_final:
logger.info(f"User: {event.transcript}")
• Node:
session.on(voice.AgentSessionEventTypes.UserInputTranscribed, (event) => {
if (event.isFinal) console.log(`User: ${event.transcript}`);
});
Recommendation: prefer conversation_item_added for a single source of truth (final messages). Which SDK are you using (Python or Node)? I can give a full example integrated with your logger.