Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions vertexai/agent_engines/templates/adk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,13 +1183,16 @@ async def streaming_agent_run_with_events(self, request_json: str):
session_service = self._tmpl_attrs.get("session_service")
artifact_service = self._tmpl_attrs.get("artifact_service")
runner = self._tmpl_attrs.get("runner")
session = None
try:
session = await session_service.get_session(
app_name=app.name if app else self._tmpl_attrs.get("app_name"),
user_id=request.user_id,
session_id=request.session_id,
)
except ClientError:
pass
if not session:
# Fall back to create session if the session is not found.
# Specifying session_id on creation is not supported,
# so session id will be regenerated.
Expand Down
5 changes: 5 additions & 0 deletions vertexai/preview/reasoning_engines/templates/adk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,14 +1017,19 @@ async def _invoke_agent_async():
session_service = self._tmpl_attrs.get("session_service")
artifact_service = self._tmpl_attrs.get("artifact_service")
runner = self._tmpl_attrs.get("runner")
session = None
try:
session = await session_service.get_session(
app_name=self._tmpl_attrs.get("app_name"),
user_id=request.user_id,
session_id=request.session_id,
)
except ClientError:
pass
if not session:
# Fall back to create session if the session is not found.
# Specifying session_id on creation is not supported,
# so session id will be regenerated.
session = await self._init_session(
session_service=session_service,
artifact_service=artifact_service,
Expand Down
Loading