Feature request
Problem
When interacting with a deployed ADK agent via the Vertex AI SDK (client.agent_engines.get()), there is no documented or explicit way to set a session TTL through adk_app.async_create_session().
The current signature is:
async_create_session(*, user_id, session_id=None, state=None, **kwargs)
While VertexAiSessionService.create_session() does support expire_time via **kwargs (which merges them into the config dict), this only works in the local execution path. When calling async_create_session on a remote AgentEngine instance (obtained via client.agent_engines.get()), the call goes through a REST proxy (reasoningEngines/{id}:query), and there is no guarantee or documentation that arbitrary kwargs like expire_time or ttl are forwarded correctly to the server-side session service.
As a result, to set session TTL on a deployed agent, users must bypass adk_app.async_create_session() entirely and use the lower-level Sessions API:
session = client.agent_engines.sessions.create(
name=agent_resource_name,
user_id=user_id,
config={"expire_time": "7200s"},
)
session_id = session.name.split("/")[-1]
This works but breaks the consistency of the adk_app.* API surface and requires mixing two different APIs (adk_app for querying, client.agent_engines.sessions for session creation).
"Solution"
Add explicit ttl and/or expire_time parameters to AdkApp.async_create_session():
session = await adk_app.async_create_session(
user_id="user_123",
ttl="7200s", # Session auto-deletes after 2 hours
# or
expire_time="2026-03-01T00:00:00Z", # Session expires at this time
)
This should work both locally (direct call) and remotely (through the REST proxy), ensuring the TTL parameter is included in the serialized input payload and properly forwarded to the underlying VertexAiSessionService.
Alts
-
Using **kwargs pass-through: adk_app.async_create_session(user_id="u_123", expire_time="7200s"). This works locally because VertexAiSessionService.create_session() merges kwargs into config. However, it's undocumented for the remote proxy path and may silently fail (session created without TTL).
-
Using the Sessions API directly: client.agent_engines.sessions.create(config={"expire_time": "7200s"}). This works but requires mixing two API surfaces and wrapping the synchronous call in asyncio.to_thread() for async backends.
Additional context
- The Manage sessions with ADK documentation shows TTL support via
VertexAiSessionService.create_session(ttl=...) but not via AdkApp.async_create_session().
- The Use an ADK agent documentation does not mention TTL at all for the remote
adk_app API.
- Source reference:
VertexAiSessionService.create_session already documents expire_time in its kwargs docstring, but this is not surfaced through AdkApp.
Feature request
Problem
When interacting with a deployed ADK agent via the Vertex AI SDK (
client.agent_engines.get()), there is no documented or explicit way to set a session TTL throughadk_app.async_create_session().The current signature is:
While
VertexAiSessionService.create_session()does supportexpire_timevia**kwargs(which merges them into theconfigdict), this only works in the local execution path. When callingasync_create_sessionon a remoteAgentEngineinstance (obtained viaclient.agent_engines.get()), the call goes through a REST proxy (reasoningEngines/{id}:query), and there is no guarantee or documentation that arbitrary kwargs likeexpire_timeorttlare forwarded correctly to the server-side session service.As a result, to set session TTL on a deployed agent, users must bypass
adk_app.async_create_session()entirely and use the lower-level Sessions API:This works but breaks the consistency of the
adk_app.*API surface and requires mixing two different APIs (adk_appfor querying,client.agent_engines.sessionsfor session creation)."Solution"
Add explicit
ttland/orexpire_timeparameters toAdkApp.async_create_session():This should work both locally (direct call) and remotely (through the REST proxy), ensuring the TTL parameter is included in the serialized
inputpayload and properly forwarded to the underlyingVertexAiSessionService.Alts
Using
**kwargspass-through:adk_app.async_create_session(user_id="u_123", expire_time="7200s"). This works locally becauseVertexAiSessionService.create_session()merges kwargs into config. However, it's undocumented for the remote proxy path and may silently fail (session created without TTL).Using the Sessions API directly:
client.agent_engines.sessions.create(config={"expire_time": "7200s"}). This works but requires mixing two API surfaces and wrapping the synchronous call inasyncio.to_thread()for async backends.Additional context
VertexAiSessionService.create_session(ttl=...)but not viaAdkApp.async_create_session().adk_appAPI.VertexAiSessionService.create_sessionalready documentsexpire_timein its kwargs docstring, but this is not surfaced throughAdkApp.