Skip to content

Restoring a saved session from the database for a Bidi streaming Agent doesn't work #1317

Closed

Description

@sumitg

I have a regular text based agent that has RAG as a tool. I have recently added Bidi streaming to provide voice capabilities and leverage most of the same agent code.

We store the session data in postgres using the DatabaseSessionService provided in the adk. This works fine for the text based agent but for the voice agent we get an error if we try to reload/resume the session.

We are using websockets for the audio interaction with live-api.

Error is
| +-+---------------- 1 ---------------- api-1 | | Traceback (most recent call last): api-1 | | File "/usr/local/lib/python3.11/site-packages/google/genai/live.py", line 1046, in connect api-1 | | yield AsyncSession(api_client=self._api_client, websocket=ws) api-1 | | File "/usr/local/lib/python3.11/site-packages/google/adk/models/google_llm.py", line 221, in connect api-1 | | yield GeminiLlmConnection(live_session) api-1 | | File "/usr/local/lib/python3.11/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 105, in run_live api-1 | | trace_send_data(invocation_context, event_id, llm_request.contents) api-1 | | File "/usr/local/lib/python3.11/site-packages/google/adk/telemetry.py", line 156, in trace_send_data api-1 | | json.dumps([ api-1 | | File "/usr/local/lib/python3.11/json/__init__.py", line 231, in dumps api-1 | | return _default_encoder.encode(obj) api-1 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | | File "/usr/local/lib/python3.11/json/encoder.py", line 200, in encode api-1 | | chunks = self.iterencode(o, _one_shot=True) api-1 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | | File "/usr/local/lib/python3.11/json/encoder.py", line 258, in iterencode api-1 | | return _iterencode(o, 0) api-1 | | ^^^^^^^^^^^^^^^^^ api-1 | | File "/usr/local/lib/python3.11/json/encoder.py", line 180, in default api-1 | | raise TypeError(f'Object of type {o.__class__.__name__} ' api-1 | | TypeError: Object of type bytes is not JSON serializable api-1

To Reproduce
Steps to reproduce the behavior:

  1. Create a basic bidi streaming agent using websockets
  2. construct a database session from the databasesessionservice instead of inmemory
  3. start the voice interaction and then leave the page or session
  4. resume session or start interaction again and see the error

Expected behavior
The session resumes

Desktop (please complete the following information):

  • OS: MacOS
  • Python version(python -V): 3.11
  • ADK version(pip show google-adk): 1.2.1

Activity

  1. added
    live[Component] This issue is related to live, voice and video chat
    on Jun 14, 2025
  2. sumitg commented on Jun 29, 2025

    @sumitg
    Author

    any updates on this?

  3. added theissue type on Jul 2, 2025
  4. hangfei commented on Jul 2, 2025

    @hangfei
    Collaborator

    This is not supported yet.

  5. sumitg commented on Jul 2, 2025

    @sumitg
    Author

    So for voice we should only use an in memory store?

  6. sjpritchard commented on Aug 19, 2025

    @sjpritchard

    Any ETA on this one?

  7. self-assigned this
    on Oct 21, 2025
  8. hangfei commented on Nov 3, 2025

    @hangfei
    Collaborator

    This is supported now. Please give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

live[Component] This issue is related to live, voice and video chat

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions