I noticed in upgrading to livekit-agents 1.3.9 my ...
# ask-ai
r
I noticed in upgrading to livekit-agents 1.3.9 my realtime models have lost all context set with
_self_.agent.update_chat_ctx
. Is this intentional update of how context is handled in the update or is there a bug here?
t
Thanks for reaching out, Riza. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I understand you're seeing realtime models lose context set with
self.agent.update_chat_ctx
after upgrading to livekit‑agents 1.3.9 and want to know if that's intentional or a bug. I don't have version‑specific release notes here, so I need a bit more information to investigate: • Which realtime model/plugin are you using? (link or name from the Realtime model plugins) • A short code snippet showing how you call
self.agent.update_chat_ctx
and how you later observe the context is lost. • Are there any errors, warnings, or log lines around the time the context disappears? • Did you also change model/provider settings or other agent/runtime config during the upgrade? • Does downgrading back to the previous livekit‑agents version restore the expected behavior? With those details I can reproduce the flow and determine whether this is an intentional change (and point to alternatives) or a bug we should escalate. Sources: Realtime model plugins | LiveKit Docs | Agents (Python) | livekit/livekit_composite | DeepWiki
r
I am using grok realtime and openai realtime. After downgrading to 1.3.8, the context is working as expected. code snippet:
Copy code
chat_ctx = ChatContext(items=[ChatMessages])
await self.agent.update_chat_ctx(chat_ctx)

self.agent = AvatarAgent(
            ctx=self.ctx,
            llm=new_llm,
            instructions="",
            tts=new_tts,
            stt=new_stt,
            vad=new_vad,
            turn_detection=new_turn_detector,
        )

  
        self.session.update_agent(self.agent)
t
Thanks — I’ve reviewed what you sent (grok + OpenAI realtime, code snippet, and that downgrading to 1.3.8 restores expected behavior). This looks like a regression in 1.3.9 where context set with
self.agent.update_chat_ctx
isn’t being preserved when you replace the agent instance (
self.agent = AvatarAgent(...)
+
self.session.update_agent(...)
). The behavior you observed — working in 1.3.8 and broken in 1.3.9 — strongly indicates it’s not an intended change. Two practical workarounds you can use immediately: • After creating the new
AvatarAgent
, re-apply the chat context before calling `self.session.update_agent(...)`: a. Create
self.agent = AvatarAgent(...)
b. Call
await self.agent.update_chat_ctx(chat_ctx)
c. Then
self.session.update_agent(self.agent)
• Or preserve the prior agent’s
chat_ctx
and pass it into the new agent on construction (if your agent constructor accepts it) so the context is available immediately. Please continue using 1.3.8 as a temporary workaround if those changes aren’t convenient. If you’d like, share logs around
update_chat_ctx
and
session.update_agent
calls and I can help verify whether the context is being dropped at agent construction or during session handoff. Sources: Realtime model plugins | LiveKit Docs | Pipeline nodes and hooks | LiveKit docs | Agents and handoffs | LiveKit docs