sessionResumption not working

Hi - I’ve tried sending { handle: null }, { handle: undefined }, and {} as sessionResumption in Gemini Live API. But I’m still not getting `message.sessionResumptionUpdate`, even after I speak to it. This is true in both audio modes (half cascade and full native).

Is this expected behavior?

Hi @M_L
This isn’t expected behavior; the server is obligated to return a sessionResumptionUpdate if the key exists, which suggests your SDK might be silently stripping the null value during serialization.

Could you please share the code snippet where you construct the setup object and your WebSocket message listener loop?

Hi @Pannaga_J . Thank you for your repsonse. Here’s the message sent to Chrome (you can see the sessionResumption key being sent). However, I do not get the message.sessionResumptionUpdate field back.

In case it’s relevant, I’m using ephemeral tokens.

Here is a sinppet of the relevant code:

  // somewhere in the class
  const ai = new GoogleGenAI({
      apiKey: this.token,
      httpOptions: {
        apiVersion: "v1alpha",
      },
    });

  const currentSession = await ai.live.connect({
      model: this.config.model,
      callbacks: {
        onopen: () => {
          console.log("Live API connected");
        },
        onmessage: (message: types.LiveServerMessage) => {
          this.handleMessage(message);
        },
        onerror: (e: ErrorEvent) => {
          console.error("Live API error:", e);
        },
      },
      config: {
        responseModalities: this.config.responseModalities,
        tools: this.config.tools,
        systemInstruction: this.config.systemInstruction,
        temperature: 0.0,
        sessionResumption: {
          handle: handle ?? undefined,
        },
        contextWindowCompression: {
          slidingWindow: {
            // Using default parameters for now as per plan
          },
        },
      },
    });

  // later in the class:
  private handleMessage(message: types.LiveServerMessage): void {
    // Check for session resumption update
    if (message.sessionResumptionUpdate) {
      console.log(
        "Received session resumption handle:",
        message.sessionResumptionUpdate,
      );
    }
  }



Hey @M_L,

Here is the Google Docs reference for session resumption:
https://ai.google.dev/gemini-api/docs/live-session#javascript_1

From my experience, the session resumption token is not sent every time or on every turn. It may only appear later in the conversation, especially when the context becomes larger and the service decides it’s needed.

Just sharing this in case it helps someone who is debugging the same behavior.

Thank you @icapora . I can have a whole conversation with the live API (hundreds of messages from gemini live) without yet seeing the message.sessionResumptionUpdate set. Is that expected?

Hello @icapora

Can you give us a timeline on a fix for this issue? If not, is it currently being worked on or no?

Thank you.

1 Like

Hey @Kristina_Fontanez just to clarify (and with a bit of a smile :grinning_face_with_smiling_eyes:): I’m not a Google employee, just another developer running into the same issue.

So I don’t have any visibility into timelines or internal roadmaps — I just shared my experience/workaround here so others can compare notes and hopefully someone from the actual Google team can jump in with an official update.

Thanks for following up on the thread!

@icapora Thanks for the clarification. I appreciate you trying to help!