solace-agent-mesh icon indicating copy to clipboard operation
solace-agent-mesh copied to clipboard

chore(DATAGO-116430): Upgrade ADK version to 1.18.0

Open Hugo-Pare opened this issue 1 month ago • 2 comments

Summary

This PR upgrades Solace Agent Mesh to Google ADK 1.18.0 and implements automatic database schema migrations, enhanced artifact version management, and improved error handling for SQL operations.

Key Changes

1. Automatic Database Migration System

Added automatic Alembic-based migrations that run on agent startup to ensure database schema compatibility with Google ADK.

New Files:

  • src/solace_agent_mesh/agent/adk/schema_migration.py - Programmatic migration runner
  • src/solace_agent_mesh/agent/adk/alembic/ - Migration directory with version history
  • src/solace_agent_mesh/agent/adk/alembic.ini - Alembic configuration
  • src/solace_agent_mesh/agent/adk/alembic/README - Migration documentation with ADK resources
  • Makefile - to streamline building project, testing etc.

Modified:

  • src/solace_agent_mesh/agent/adk/services.py - Auto-executes migrations on SQL session service initialization

Features:

  • Migrations run automatically on agent startup when using SQL session services
  • Uses Google's official Alembic approach for schema detection and updates
  • Version-controlled migration history
  • Safe updates: only adds missing columns, never deletes data
  • Supports SQLite, PostgreSQL, and MySQL

Reference: Based on Google ADK's official migration example

2. Enhanced Artifact Version Management

Implemented new ADK 1.18.0 artifact methods for improved version tracking and metadata access.

Modified:

  • src/solace_agent_mesh/agent/adk/artifacts/filesystem_artifact_service.py
  • src/solace_agent_mesh/agent/adk/artifacts/s3_artifact_service.py

New Methods:

  • list_artifact_versions() - Lists all versions with complete metadata (version, URI, MIME type, creation time)
  • get_artifact_version() - Retrieves metadata for a specific artifact version

Benefits:

  • Full artifact version history tracking
  • Enhanced metadata access without loading full artifact content
  • Better support for artifact management workflows

3. Long-Running Tool Support

Enhanced ADK flow handling to properly support long-running tools and prevent premature flow termination.

Modified:

  • src/solace_agent_mesh/agent/sac/patch_adk.py

Changes:

  • Updated patch_run_async() to detect and handle long-running tool calls
  • Prevents flow from breaking when tools indicate they're still processing
  • Maintains compatibility with existing tool execution patterns

4. Dependency Upgrades

Updated core Google dependencies to latest stable versions:

Modified:

  • pyproject.toml

Upgrades:

  • google-adk: 1.18.0 (from 1.7.0)
  • google-genai: 1.49.0
  • google-cloud-aiplatform: 1.126.1
  • google-cloud-storage: 3.5.0

updated to testing deps pinpointing fastmcp for compatibility.

Benefits:

  • Access to latest ADK features and improvements
  • Enhanced LLM response handling
  • Improved storage compatibility
  • Security updates and bug fixes

5. Improved SQL Error Handling

Enhanced error handling for database operations to provide better user feedback.

Modified:

  • src/solace_agent_mesh/agent/protocol/event_handlers.py

Improvements:

  • Catches OperationalError exceptions from SQLAlchemy

  • Differentiates between schema errors and general database errors

  • Provides user-friendly error messages:

    • Schema errors: Directs users to contact administrator for migrations
    • General errors: Suggests retry or contacting support
  • Properly NACKs failed messages with appropriate error responses

Migration Guide

For Existing Deployments

Automatic Migration: When agents start with SQL session services, the migration system automatically:

  1. Detects missing database columns
  2. Applies necessary schema updates
  3. Logs migration progress

No manual intervention required - migrations run seamlessly on startup.

For Development

To manually generate new migrations when ADK releases schema changes:

cd src/solace_agent_mesh/agent/adk
alembic revision --autogenerate -m "Update for ADK x.x.x"

Testing

make test-setup
make test-all 
  • ✅ Tested migration from ADK 1.7.0 to 1.18.0
  • ✅ Verified artifact version management with filesystem and S3 backends
  • ✅ Confirmed long-running tool support with peer agent calls
  • ✅ Validated SQL error handling with schema mismatches

Breaking Changes

ADK 1.18.0 introduced a resumability feature with the following API changes in src/google/adk/runners.py:

1. Added new parameter: invocation_id (Optional[str]) for resuming interrupted invocations
2. Changed new_message from REQUIRED to OPTIONAL to support resumption without new input
3. Added strict validation: "if not invocation_id and not new_message: raise ValueError"

as result of the above one can not supply None for content and no invocation_id, thus in order to respect new contract tool result content is wired and new message rather than writing to session:

relevant change: https://github.com/SolaceLabs/solace-agent-mesh/blob/a60ae435d9a6c12c5d96564daf2a8cad8a173f8a/src/solace_agent_mesh/agent/sac/component.py#L796

Documentation

  • Added comprehensive README in src/solace_agent_mesh/agent/adk/alembic/README
  • Includes links to Google ADK migration examples and documentation
  • Documents manual migration procedures for development use

Hugo-Pare avatar Nov 12 '25 19:11 Hugo-Pare

Quality Gate failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 70%)

See analysis details on SonarQube

the title should not be chore, it should at least be a fix or feat

cyrus2281 avatar Nov 25 '25 21:11 cyrus2281