Description
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
- Install
google-genai==1.21.0
andadk-python>=1.3.0
and useVertexAiSessionService
to manage sesions. - Run Agent and create a session.
- 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.
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.