is there a way to access `session.history` from ag...
# ask-ai
r
is there a way to access
session.history
from agent with timestamps? or some other conversation history (that stays in sync with interruptions) that also contains message timestamps?
t
Thanks for reaching out, Ivan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm happy to help you access conversation history with timestamps in LiveKit! Here are a few ways you can do that: • Agent-Side Access: You can use
session.history
to get the full conversation history during a session. Plus, if you want to keep track of new messages as they come in, listening to real-time events like
conversation_item_added
is a great option. • Client-Side Access: If you’re working with the Swift SDK, the
getMessageHistory()
method lets you retrieve an array of messages, each with its own timestamp. • Custom History: Another approach is to create your own conversation history using a custom data structure, like a list or dictionary, where you can log each interaction along with its timestamp. If you'd like, I can provide specific examples or guide you through any of these methods. Just let me know how I can assist you further! Sources: Session recording and transcripts | LiveKit Docs | Sources/LiveKit/Agent/Session.swift | context-readmes/USERDATA_GUIDE.md | Testing and evaluation | LiveKit Docs | Sending text | LiveKit docs