lively-coat-10905
11/04/2025, 3:44 PMAfter callingContext: Currently, when callingto flush an incomplete assistant turn (due to user interruption), what is the proper way to retrieve the complete LLM-generated message from the agent — not just the truncated TTS-aligned transcript?await session.aclose()
await session.aclose(), the latest conversation_item_added event provides only the spoken portion (truncated text).
We want the full LLM message that was generated internally by the agent.
Goal:
Clarify whether:
• We should read from session.history[-1].text_content, or
• There’s another way to access the full message before/after aclose() (for example, through conversation_item_committed or a property in AgentSession).tall-airline-16756
11/04/2025, 3:44 PMtall-airline-16756
11/04/2025, 3:46 PMconversation_item_added and read event.item (the ChatMessage) when it fires, or
◦ After await session.aclose() completes, read it from session.history (e.g., session.history[-1].text_content).
Notes:
• aclose() flushes any incomplete assistant turn so it’s committed and available via history/events.
• TTS-aligned transcripts can be truncated; rely on chat history for the complete message.
References: Events, Session history/recording, Transcriptions vs. chat text, Transcript timing
Sources: How to capture real-time agent transcriptions during conversations | Events and error handling | LiveKit docs | Session recording and transcripts | LiveKit Docs | Text and transcriptions | LiveKit docs | Understanding Transcript Timing in Voice Conversations