8000 Throw exceptions when using `VertexAiSessionService` with `google-genai` 1.21.0 · Issue #1514 · google/adk-python · GitHub
[go: up one dir, main page]

Skip to content
Throw exceptions when using VertexAiSessionService with google-genai 1.21.0 #1514
@soundTricker

Description

@soundTricker

Describe the bug
When using VertexAiSessionService with google-genai 1.21.0, create_session method (maybe also other methods) throw exception with below log.

vertex_ai_session_service.py:80 - Create Session response headers={'Content-Type': 'application/json; charset=UTF-8', 'Vary': 'Referer', 'Content-Encoding': 'gzip', 'Date': 'Thu, 19 Jun 2025 06:34:24 GMT', 'Server': 'ESF', 'X-XSS-Protection': '0', 'X-Frame-Options': 'SAMEORIGIN', 'X-Content-Type-Options': 'nosniff', 'Alt-Svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000', 'Transfer-Encoding': 'chunked'} body='{\n  "name": "projects/813188275284/locations/us-central1/reasoningEngines/1585944367997124608/sessions/6910699411165151232/operations/1616170870357622784",\n  "metadata": {\n    "@type": "type.googleapis.com/google.cloud.aiplatform.v1beta1.CreateSessionOperationMetadata",\n    "genericMetadata": {\n      "createTime": "2025-06-19T06:34:24.124032Z",\n      "updateTime": "2025-06-19T06:34:24.124032Z"\n    }\n  }\n}\n'
File "/usr/local/lib/python3.12/site-packages/google/adk/cli/fast_api.py", line 422, in create_session
session = await session_service.create_session(
File "/usr/local/lib/python3.12/site-packages/google/adk/sessions/vertex_ai_session_service.py", line 92, in create_session
session_id = api_response['name'].split('/')[-3]
TypeError: 'HttpResponse' object is not subscriptable

To Reproduce

  1. Install google-genai==1.21.0 and adk-python>=1.3.0 and use VertexAiSessionService to manage sesions.
  2. Run Agent and create a session.
  3. See error

Expected behavior
No error

Desktop (please complete the following information):

  • Python version(python -V): 3.12
  • ADK version(pip show google-adk): 1.3.0
  • Platform: cloud run, agentengine

Additional context
From google-genai 1.21.0, genai api client response is changed with full response.
So it does not return dict object.

googleapis/python-genai@8c9e4ba#diff-af6bee559d65a77d542f74d9cdcc4a3fd7fa1b82e9474b5f270873f070d565c9

But VertexAiSessionService does not keeping up with the changes.
https://github.com/google/adk-python/blob/main/src/google/adk/sessions/vertex_ai_session_service.py#L92

Current solution is the google-genai version must be fixed to 1.20.0 or lower.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0