8000 Restoring a saved session from the database for a Bidi streaming Agent doesn't work · Issue #1317 · google/adk-python · GitHub
[go: up one dir, main page]

Skip to content
Restoring a saved session from the database for a Bidi streaming Agent doesn't work #1317
Open
@sumitg

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0