adk-python icon indicating copy to clipboard operation
adk-python copied to clipboard

GET /sessions/{session_id} returns list instead of single session object

Open wltnrhkd123 opened this issue 1 year ago • 3 comments

Describe the bug

When calling the GET /reasoningEngines/{reasoning_engine_id}/sessions/{session_id} endpoint with a specific session_id, the response unexpectedly returns a list of sessions under the "sessions" key instead of a single session object. This behavior contradicts the expected functionality for retrieving a specific session.

To Reproduce

Steps to reproduce the behavior:

  1. Make a request to GET /reasoningEngines/{reasoning_engine_id}/sessions/{session_id} using a valid session_id.
  2. Observe the response.
  3. The API returns:
    {
      "sessions": [
        {
          "name": "...",
          "createTime": "...",
          "updateTime": "...",
          ...
        },
        ...
      ]
    }
    
    instead of a single session object.

Expected behavior

The API should return only one session object, corresponding to the session_id specified in the request path. For example:

{
  "name": "projects/.../sessions/{session_id}",
  "createTime": "...",
  "updateTime": "...",
  "sessionState": {...},
  ...
}

Desktop (please complete the following information):

  • OS: Windows 10
  • Python version (python -V): 3.12.5
  • ADK version (pip show google-adk): 0.1.0

Additional context

This behavior might indicate the server is ignoring the session_id path parameter and instead routing the request to the session list endpoint. The issue breaks code that expects a single session object and leads to runtime errors when accessing fields like response['name'].

wltnrhkd123 avatar Apr 16 '25 23:04 wltnrhkd123

This issue arises specifically when using the VertexAiSessionService class from vertex_ai_session_service.py.

wltnrhkd123 avatar Apr 16 '25 23:04 wltnrhkd123

@DeanChensj to help take a look.

hangfei avatar Apr 17 '25 00:04 hangfei

Hi @wltnrhkd123 , is the session id you used generated by the VertexAiSessionService? Is it a numeric id?

I'm not able to reproduce the issue, could you elaborate on how are you running the agent? Are you deploying onto Agent Engine, using AdkApp template, or just testing with the VertexAiSessionService?

If possible, could you share the reasoning engine id and session id?

DeanChensj avatar Apr 26 '25 00:04 DeanChensj