Skip to content

Commit 4c86190

Browse files
Tongzhou-Jiangcopybara-github
authored andcommitted
fix: investigation on session state
PiperOrigin-RevId: 831082835
1 parent 1f1f67e commit 4c86190

File tree

1 file changed

+10
-0
lines changed
  • vertexai/agent_engines/templates

1 file changed

+10
-0
lines changed

vertexai/agent_engines/templates/adk.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,9 @@ async def _init_session(
602602
):
603603
"""Initializes the session, and returns the session id."""
604604
from google.adk.events.event import Event
605+
from google.cloud.aiplatform import base
606+
607+
_LOGGER = base.Logger(__name__)
605608

606609
session_state = None
607610
if request.authorizations:
@@ -620,7 +623,9 @@ async def _init_session(
620623
if request.events:
621624
for event in request.events:
622625
await session_service.append_event(session, Event(**event))
626+
_LOGGER.info("Before Saving artifacts: %s", request.artifacts)
623627
if request.artifacts:
628+
_LOGGER.info("In Saving artifacts: %s", request.artifacts)
624629
for artifact in request.artifacts:
625630
artifact = _Artifact(**artifact)
626631
for version_data in sorted(
@@ -1073,8 +1078,12 @@ async def streaming_agent_run_with_events(self, request_json: str):
10731078
import json
10741079
from google.genai import types
10751080
from google.genai.errors import ClientError
1081+
from google.cloud.aiplatform import base
1082+
1083+
_LOGGER = base.Logger(__name__)
10761084

10771085
request = _StreamRunRequest(**json.loads(request_json))
1086+
_LOGGER.info(f"request artifacts: {request.artifacts}")
10781087
if not self._tmpl_attrs.get("in_memory_runner"):
10791088
self.set_up()
10801089
if not self._tmpl_attrs.get("runner"):
@@ -1140,6 +1149,7 @@ async def streaming_agent_run_with_events(self, request_json: str):
11401149
yield converted_event
11411150
finally:
11421151
if session and not request.session_id:
1152+
_LOGGER.info(f"Dumping session state: {session.state}")
11431153
app = self._tmpl_attrs.get("app")
11441154
await session_service.delete_session(
11451155
app_name=app.name if app else self._tmpl_attrs.get("app_name"),

0 commit comments

Comments
 (0)