How does livekit handle the session memory? Are th...
# ask-ai
f
How does livekit handle the session memory? Are there options for us to configure how livekit handles the AgentSession memory? whether it summarises the history or passes the entire history?
t
Thanks for reaching out, Mok. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! Just so you know, LiveKit keeps the entire conversation history in
session.history
, and you can access it anytime during your session. By default, it saves everything, and there isn’t a built-in way to automatically summarize the history before sending it to the LLM. But no worries—you can totally set up your own summarization using external tools or by managing the context yourself. For instance, you might want to create a custom
ChatContext
that only includes the most important messages, or use some scripts to summarize longer histories. Also, if you want to keep things smooth between agents, just pass the
chat_ctx
parameter when you start an agent. If you’d like, I’m here to help you figure out how to set up custom summarization or manage session memory—especially if you’re aiming to save on costs or speed things up. Just give me a shout! Sources: Development Tools | livekit/livekit_composite | DeepWiki | livekit-agents/livekit/agents/voice/agent_session.py | complex-agents/role-playing/core/game_state.py | Sending text | LiveKit Docs | Sending text | LiveKit Docs