I'm debugging conversation history in LiveKit Agen...
# ask-ai
s
I'm debugging conversation history in LiveKit Agents and found something strange with session.history.items. I'm building an interview agent that makes separate LLM evaluation calls on each user turn (not using the built-in chat flow), and the user messages aren't appearing in session.history. My setup: python Apply to total_agent.... # I create separate ChatContext objects and call llm.chat() for evaluation async def on_user_turn_completed(self, _turn_ctx_, _new_message_): eval_chat_ctx = ChatContext() eval_chat_ctx.add_message(role="system", content=self.system_prompt) # Try to get conversation history for item in self.session.history.items: print(f"Item: role={item.role}, content={item.text_content}") Debug output shows: text Apply to total_agent.... === DEBUG: RAW SESSION.HISTORY ITEMS === Item 0: role=assistant, text_content='Can you describe your overall experience...' Item 1: role=assistant, text_content='How did attending this concert meet or differ...' Item 2: role=assistant, text_content='Based on this experience, how likely are you...' === END RAW SESSION.HISTORY === But LiveKit logs show user transcripts ARE being received: text Apply to total_agent.... DEBUG livekit.agents - received user transcript {"user_transcript": "Sure.", "language": "en"} DEBUG livekit.agents - received user transcript {"user_transcript": "Let's see. I really like the concert overall...", "language": "en"} Question: Does session.history only maintain conversation history when using the standard agent chat flow? Since I'm making custom LLM calls instead of using the built-in conversation management, are user messages not being added to session.history? How should I access the complete conversation history including user responses in this setup?
t
Thanks for reaching out, Jason. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
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!