Skip to content

VertexAiSessionService#get_session raise an error when a session has many events (list_events_api_response has nextPageToken) #1772

Open
@soundTricker

Description

@soundTricker

Describe the bug
VertexAiSessionService#get_session raise an error when when a session has many events. (list_events_api_response has nextPageToken.)

This might be oversight in below commit.
4d72d31

Stacktrace:

File "/usr/local/lib/python3.12/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/google/adk/cli/fast_api.py", line 388, in get_session
session = await session_service.get_session(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/google/adk/sessions/vertex_ai_session_service.py", line 220, in get_session
for event in list_events_api_response['sessionEvents']
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
TypeError: 'HttpResponse' object is not subscriptable

To Reproduce
Steps to reproduce the behavior:

  1. Install adk-python 1.5.0 and gogole-genai >= 1.21.0
  2. Run agent with too many event. and get session with VertexAiSessionService.
  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.5.0

Model Information:
All model.

Additional context
I will provide pr.

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