🔴 Required Information
Describe the Bug:
A ValueError is raised in google-adk version 2.2.0 when running an agent hosted on Agent Runtime -- formerly known as Agent Engine / Reasoning Engine (using Vertex AI managed sessions) and querying it from Gemini Enterprise App.
The fully qualified session resource path (which contains slashes /) was passed to the session service. This fails the strict session ID format check (_validate_session_id) added to vertex_ai_session_service.py in 2.2.0 (commit b2916c7).
Steps to Reproduce:
- Deploy a Python ADK agent using
google-adk version 2.2.0 on Google Cloud Agent Runtime.
- Query the agent via the Gemini Enterprise app.
- The platform sends a fully qualified session path.
- The server throws a
ValueError, seen in Google Cloud Logging.
Expected Behavior:
The SDK should either parse/sanitize the fully qualified resource name to extract the short session ID (last segment after /) before validation, or the validator should support full resource paths when invoked by the platform runner.
Observed Behavior:
The server crash logs show:
ValueError: Invalid session_id 'projects/my_project_number/locations/global/collections/default_collection/engines/my_app/sessions/my_session_id': must match ^[A-Za-z0-9_-]+$.
Environment Details:
- ADK Library Version (pip show google-adk):
2.2.0
- Desktop OS: macOS
- Python Version (python -V): Python 3.11
Model Information:
- Are you using LiteLLM: No
- Which model is being used:
gemini-3.5-flash
🟡 Optional Information
Regression:
Yes. This worked in google-adk versions prior to 2.2.0 where the _validate_session_id check was not yet present.
The regression was introduced in the commit: b2916c7 (related to #5580).
Logs:
File "/home/myuser/.local/lib/python3.11/site-packages/google/adk/cli/fast_api.py", line 797, in json_generator
async for chunk in output:
File "/home/myuser/.local/lib/python3.11/site-packages/vertexai/agent_engines/templates/adk.py", line 1342, in streaming_agent_run_with_events
session = await session_service.get_session(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/myuser/.local/lib/python3.11/site-packages/google/adk/sessions/vertex_ai_session_service.py", line 181, in get_session
_validate_session_id(session_id)
File "/home/myuser/.local/lib/python3.11/site-packages/google/adk/sessions/vertex_ai_session_service.py", line 58, in _validate_session_id
raise ValueError(
ValueError: Invalid session_id 'projects/my_project_number/locations/global/collections/default_collection/engines/my_app/sessions/my_session_id': must match ^[A-Za-z0-9_-]+$.
Additional Context:
The commit b2916c7 added _validate_session_id to verify session IDs against ^[A-Za-z0-9_-]+$. However, the ADK runner forwards the full platform path to Vertex AI Session Service, bypassing any extraction, which leads to this crash in hosted environments.
How often has this issue occurred?:
- Always (100%) when queried from platforms sending fully qualified paths (like Gemini Enterprise).

🔴 Required Information
Describe the Bug:
A
ValueErroris raised ingoogle-adkversion2.2.0when running an agent hosted on Agent Runtime -- formerly known as Agent Engine / Reasoning Engine (using Vertex AI managed sessions) and querying it from Gemini Enterprise App.The fully qualified session resource path (which contains slashes
/) was passed to the session service. This fails the strict session ID format check (_validate_session_id) added tovertex_ai_session_service.pyin2.2.0(commit b2916c7).Steps to Reproduce:
google-adkversion2.2.0on Google Cloud Agent Runtime.ValueError, seen in Google Cloud Logging.Expected Behavior:
The SDK should either parse/sanitize the fully qualified resource name to extract the short session ID (last segment after
/) before validation, or the validator should support full resource paths when invoked by the platform runner.Observed Behavior:
The server crash logs show:
Environment Details:
2.2.0Model Information:
gemini-3.5-flash🟡 Optional Information
Regression:
Yes. This worked in
google-adkversions prior to2.2.0where the_validate_session_idcheck was not yet present.The regression was introduced in the commit: b2916c7 (related to #5580).
Logs:
Additional Context:
The commit b2916c7 added
_validate_session_idto verify session IDs against^[A-Za-z0-9_-]+$. However, the ADK runner forwards the full platform path to Vertex AI Session Service, bypassing any extraction, which leads to this crash in hosted environments.How often has this issue occurred?: