silly-baker-11446
09/02/2025, 9:27 PMtall-airline-16756
09/02/2025, 9:27 PMtall-airline-16756
09/02/2025, 9:27 PMsession.history property. It automatically captures all the chat items as they happen—both from the user and the assistant—and updates in real time.
Here are a few helpful tips to make sure the history stays intact:
• Use the conversation_item_added event to catch each new message added to the chat history.
• Double-check that your code isn’t overwriting or skipping user messages when looping through session.history.items.
• If you want to save the conversation after the session ends, use the add_shutdown_callback method to store the entire history in a file or database.
• When switching between agents, pass the chat_ctx from one agent to the next using the Agent or AgentTask constructor to keep all the previous context.
For your specific code, make sure the loop over session.history.items properly handles every user message without accidentally skipping or overwriting anything. If you want me to walk through it with you or need a hand, just let me know!
Sources: Workflows | LiveKit Docs | Sending text | LiveKit Docs