|
|
Agent Engine Versioning and Rollback
Author: Venkata Sudhakar
Every time you call AdkApp.create() or remote_app.update() on Vertex AI Agent Engine, it creates a new version of your deployed agent. Agent Engine stores the history of all versions so you can instantly roll back to any previous version if a new deployment causes quality issues. This is what makes Agent Engine safe for production - you can deploy updated instructions or new tools with confidence that you can revert in seconds without downtime. Combined with pre-deployment evaluation (Tutorial 319), versioning gives you a complete safe deployment pipeline. The versioning workflow: deploy v1 with AdkApp.create(), save the resource_name. When ready to update, call remote_app.update() with the new agent - this does a zero-downtime rolling update. If a post-deploy quality check fails, call remote_app.update() again with the previous agent definition to rollback instantly. In production, maintain a version registry (a simple JSON file or database row) mapping version labels to resource names so you always know what is running and have the previous version definition ready for rollback. The below example shows the full versioning lifecycle: deploy v1, update to v2 with improved instructions, detect a quality regression via evaluation score, and rollback to v1 - all through the Agent Engine API with zero downtime.
Updating to v2 and rolling back when a quality regression is detected,
It gives the following output showing the full deploy-evaluate-rollback cycle,
Deploying v1...
v1 deployed: projects/my-project/locations/us-central1/reasoningEngines/111
Version registry saved.
Updating to v2 (zero-downtime rolling update)...
v2 deployed: projects/my-project/locations/us-central1/reasoningEngines/111
Post-deploy eval score: 72 % (threshold: 80%)
REGRESSION DETECTED - rolling back to v1...
Rollback complete. v1 is live again.
# Note: resource_name stays the same after update - same endpoint URL
# The underlying model/instruction changes but the API endpoint does not
# Users experience zero downtime during both the update AND the rollback
# v2 definition retained in agent_v2 variable for debugging and re-deploy
Pre-deploy checklist validates the agent configuration before every release,
=== PRE-DEPLOY CHECKLIST ===
PASS | Model specified
PASS | Name set
PASS | Instruction non-empty
PASS | Tools registered
Checklist: READY TO DEPLOY
Versioning golden rules for production Agent Engine: never deploy directly to production without a staging Agent Engine instance first. Always run the full eval suite before promoting from staging to production. Tag every version with a semantic version number and the git commit hash in the description field - you will thank yourself when investigating incidents. Keep the last 3 agent definitions in your version registry so you can roll back through multiple releases. Set up a deployment runbook that the whole team follows: evaluate, deploy staging, run integration tests, promote production, monitor for 30 minutes, declare stable or rollback.
|
|