> After calling `await session.aclose()` to flu...
# ask-ai
l
After calling
await session.aclose()
to 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?
Context: Currently, when calling
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
).
t
Thanks for reaching out, Computer. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It sounds like you’re seeing only the spoken (truncated) text after an interrupted turn. To get the full LLM-generated message: • Use the committed chat item, not the TTS transcript. • Either: ◦ Listen for
conversation_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