Description
There are two issues that prevent external callers from being able to filter the events fetched when calling async_get_session on a deployed Agent Engine agent:
AdkApp.async_get_session doesn't deserialize config from kwargs (ADK bug)
AdkApp.async_get_session accepts **kwargs and forwards them to session_service.get_session():
vertexai/agent_engines/templates/adk.py L1282-1314
async def async_get_session(self, *, user_id: str, session_id: str, **kwargs):
session = await self._tmpl_attrs.get("session_service").get_session(
app_name=...,
user_id=user_id,
session_id=session_id,
**kwargs,
)
BaseSessionService.get_session expects config: Optional[GetSessionConfig], which is a Pydantic BaseModel. If a caller passes config={"num_recent_events": 10} (a dict, as would arrive from JSON deserialization), it will fail because the dict is not automatically coerced into a GetSessionConfig instance.
The fix would be to deserialize the dict in async_get_session:
from google.adk.sessions.base_session_service import GetSessionConfig
async def async_get_session(self, *, user_id: str, session_id: str, **kwargs):
if "config" in kwargs and isinstance(kwargs["config"], dict):
kwargs["config"] = GetSessionConfig(**kwargs["config"])
...
- Agent Engine platform does not forward extra params (platform issue)
Even after the above fix, the Agent Engine platform proxy — the closed-source layer that receives external API requests and invokes methods on the deployed agent — only forwards user_id and session_id to async_get_session. There is no mechanism for an external caller to include config, num_recent_events, after_timestamp, or any other parameter in the request.
Steps to reproduce
Deploy an ADK agent to Agent Engine
Create a session and run a query (generates events)
Call async_get_session through the Agent Engine API with user_id and session_id
Observe there is no way to pass GetSessionConfig params num_recent_events or after_timestamp through the API
Even if you could, the **kwargs would pass a raw dict to session_service.get_session() which expects a GetSessionConfig instance — this would raise an error
Expected behavior
AdkApp.async_get_session should accept and deserialize GetSessionConfig-compatible parameters from kwargs
The Agent Engine platform should forward these parameters from the external API request to the deployed agent method
Related issues
#3562 — Runner.run_async also doesn't pass GetSessionConfig to get_session (same gap, internal code path)
#3039 — VertexAiSessionService.get_session becomes slow with many events (consequence of never filtering)
Environment
google-adk 1.x (latest)
google-cloud-aiplatform (latest)
Deployed to Vertex AI Agent Engine
Description
There are two issues that prevent external callers from being able to filter the events fetched when calling
async_get_sessionon a deployed Agent Engine agent:AdkApp.async_get_sessiondoesn't deserialize config from kwargs (ADK bug)AdkApp.async_get_sessionaccepts **kwargs and forwards them to session_service.get_session():vertexai/agent_engines/templates/adk.py L1282-1314
async def async_get_session(self, *, user_id: str, session_id: str, **kwargs):BaseSessionService.get_sessionexpectsconfig: Optional[GetSessionConfig], which is a Pydantic BaseModel. If a caller passes config={"num_recent_events": 10} (a dict, as would arrive from JSON deserialization), it will fail because the dict is not automatically coerced into a GetSessionConfig instance.The fix would be to deserialize the dict in async_get_session:
Even after the above fix, the Agent Engine platform proxy — the closed-source layer that receives external API requests and invokes methods on the deployed agent — only forwards user_id and session_id to async_get_session. There is no mechanism for an external caller to include config, num_recent_events, after_timestamp, or any other parameter in the request.
Steps to reproduce
Deploy an ADK agent to Agent Engine
Create a session and run a query (generates events)
Call async_get_session through the Agent Engine API with user_id and session_id
Observe there is no way to pass GetSessionConfig params
num_recent_eventsorafter_timestampthrough the APIEven if you could, the **kwargs would pass a raw dict to
session_service.get_session()which expects a GetSessionConfig instance — this would raise an errorExpected behavior
AdkApp.async_get_session should accept and deserialize GetSessionConfig-compatible parameters from kwargs
The Agent Engine platform should forward these parameters from the external API request to the deployed agent method
Related issues
#3562 — Runner.run_async also doesn't pass GetSessionConfig to get_session (same gap, internal code path)
#3039 — VertexAiSessionService.get_session becomes slow with many events (consequence of never filtering)
Environment
google-adk 1.x (latest)
google-cloud-aiplatform (latest)
Deployed to Vertex AI Agent Engine