Skip to content

feat(cli): expose session rewind on Agent Engine and api_server - #6704

Open
a2105z wants to merge 1 commit into
google:mainfrom
a2105z:feat/agent-engine-rewind
Open

feat(cli): expose session rewind on Agent Engine and api_server#6704
a2105z wants to merge 1 commit into
google:mainfrom
a2105z:feat/agent-engine-rewind

Conversation

@a2105z

@a2105z a2105z commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

Summary

Expose session rewind for Agent Engine / adk api_server deployments so edit-message / undo flows work without relying on the Vertex Sessions appendEvent proto (which rejects rewind_before_invocation_id).

What changed

  • Register async_rewind in Agent Engine _AGENT_ENGINE_CLASS_METHODS (deploy metadata + allowlist)
  • Bind an ADK-owned async_rewind on the Agent Engine AdkApp instance used by /api/reasoning_engine (calls runner.rewind_async, returns updated session)
  • Add REST POST /apps/{app}/users/{user}/sessions/{session}/rewind

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.
uv run pytest tests/unittests/cli/test_fast_api.py::test_rewind_session_endpoint \
  tests/unittests/cli/test_fast_api.py::test_rewind_session_not_found \
  tests/unittests/cli/test_fast_api.py::test_gemini_reasoning_engine_async_rewind \
  tests/unittests/cli/test_fast_api.py::test_async_rewind_is_registered_agent_engine_class_method -q
....                                                                     [100%]
4 passed

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

Additional context

cc @wuliang229 @yeesian — ready for review when you have a chance.

Managed Agent Engine deploys could not edit/undo messages because rewind
was only available via runner.rewind_async. Register async_rewind in
Agent Engine class_methods, bind a runtime implementation for
/api/reasoning_engine, and add POST .../sessions/{id}/rewind.

Fixes google#4121
@a2105z

a2105z commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@wuliang229 @yeesian — this implements #4121 (Agent Engine / api_server session rewind). Ready for your review whenever you have bandwidth. Thanks!

@adk-bot adk-bot added the cli [Component] This issue is related to cli label Aug 13, 2026
@a2105z

a2105z commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@wyf7107 — this implements #4121 (Agent Engine / api_server session rewind). Ready for your review whenever you have a chance. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli [Component] This issue is related to cli

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Expose rewind functionality via Agent Engine REST API

3 participants