Repository navigation
fix: include rewind_before_invocation_id in VertexAiSessionService.append_event - #4978
yuting0624 wants to merge 4 commits into
Conversation
…pend_event (google#4930) VertexAiSessionService.append_event() was not including rewind_before_invocation_id in the actions dict sent to the Vertex AI API. This caused rewind events to lose their target invocation ID when persisted, making session rewind non-functional for Agent Engine deployments. Added the missing field to the actions dict and a round-trip test. Fixes google#4930
|
Response from ADK Triaging Agent Hello @yuting0624, thank you for your contribution! It looks like the ./autoformat.shThis will ensure your changes adhere to the project's coding style. Thanks! |
|
Hi @yuting0624, does this fix works? I tried it and got the following error: Looking at this, it looks like the Should we use |
…dantic validation error The Vertex AI SDK's Pydantic model does not yet support rewind_before_invocation_id in EventActions, causing 'Extra inputs are not permitted' errors. Store it in custom_metadata following the same pattern used for compaction. Addresses feedback from lucasbarzotto-axonify on PR google#4978.
|
Thanks for catching this @lucasbarzotto-axonify! You're absolutely right — the Vertex AI SDK doesn't support I've pushed a fix that stores it in
All 25 session service tests pass. The Pydantic validation error should no longer occur. |
|
Thanks for the contribution! Instead of introducing a new custom piggyback field (or extending the schema with a new custom parameter for this), we should leverage the underlying SDK's existing raw_event (or raw/extra data) field. This keeps the ADK schema cleaner and natively aligns with how the SDK already passes through arbitrary underlying event properties. Could you update the implementation to map this data using the SDK's raw event field instead? Let us know if you need any pointers on where it's exposed! |
Summary
Fixes #4930
VertexAiSessionService.append_event()was not includingrewind_before_invocation_idin theactionsdict sent to the Vertex AI Agent Engine API. This caused rewind events to lose their target invocation ID when persisted, making session rewind non-functional for Agent Engine deployments.Changes
src/google/adk/sessions/vertex_ai_session_service.py: Addedrewind_before_invocation_idto the actions dict inappend_event()(3 lines)tests/unittests/sessions/test_vertex_ai_session_service.py: Addedtest_append_event_with_rewindto verify the field round-trips correctly through append and getRoot Cause
The
actionsdict construction inappend_event()explicitly maps each field fromEventActionsto the API payload, butrewind_before_invocation_idwas omitted. Other fields liketransfer_to_agent,state_delta,skip_summarization, etc. were all present.