Skip to content
Closed
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
10 changes: 10 additions & 0 deletions vertexai/agent_engines/templates/adk.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,9 @@ async def _init_session(
):
"""Initializes the session, and returns the session id."""
from google.adk.events.event import Event
from google.cloud.aiplatform import base

_LOGGER = base.Logger(__name__)

session_state = None
if request.authorizations:
Expand All @@ -620,7 +623,9 @@ async def _init_session(
if request.events:
for event in request.events:
await session_service.append_event(session, Event(**event))
_LOGGER.info("Before Saving artifacts: %s", request.artifacts)
if request.artifacts:
_LOGGER.info("In Saving artifacts: %s", request.artifacts)
for artifact in request.artifacts:
artifact = _Artifact(**artifact)
for version_data in sorted(
Expand Down Expand Up @@ -1073,8 +1078,12 @@ async def streaming_agent_run_with_events(self, request_json: str):
import json
from google.genai import types
from google.genai.errors import ClientError
from google.cloud.aiplatform import base

_LOGGER = base.Logger(__name__)

request = _StreamRunRequest(**json.loads(request_json))
_LOGGER.info(f"request artifacts: {request.artifacts}")
if not self._tmpl_attrs.get("in_memory_runner"):
self.set_up()
if not self._tmpl_attrs.get("runner"):
Expand Down Expand Up @@ -1140,6 +1149,7 @@ async def streaming_agent_run_with_events(self, request_json: str):
yield converted_event
finally:
if session and not request.session_id:
_LOGGER.info(f"Dumping session state: {session.state}")
app = self._tmpl_attrs.get("app")
await session_service.delete_session(
app_name=app.name if app else self._tmpl_attrs.get("app_name"),
Expand Down