Skip to content

dependencies/vertexai.py eagerly imports the deprecated vertexai.preview.rag, so every evaluation import warns #7415

Closed

Description

@roanny

Required Information

Describe the Bug:
google/adk/dependencies/vertexai.py imports vertexai.preview.rag at module level. Since google-cloud-aiplatform deprecated that module, the import emits a UserWarning on load. Every ADK module that imports anything from ..dependencies.vertexai therefore triggers it, even when it only needs vertexai itself. That includes evaluation/vertex_ai_eval_facade.py:29 (from ..dependencies.vertexai import vertexai) and the other evaluation modules. As a result, every AgentEvaluator / adk eval run prints the deprecation warning, although no RAG code is used. Under -W error::UserWarning (or filterwarnings = error in pytest) the import fails.

The code is unchanged on main (d4e092e): src/google/adk/dependencies/vertexai.py:19 still reads from vertexai.preview import rag as rag.

Steps to Reproduce:

  1. pip install "google-adk[eval]==2.11.0" "google-cloud-aiplatform==1.163.0".
  2. python -W error::UserWarning -c "import google.adk.evaluation.vertex_ai_eval_facade"

Expected Behavior:
Importing ADK's evaluation modules emits no deprecation warning for a module they do not use. The RAG import should happen only where RAG is used (tools/retrieval/vertex_ai_rag_retrieval.py already imports it only under TYPE_CHECKING, line 35, and inside the call, line 103), or move to the replacement client.

Observed Behavior:

  File ".../google/adk/evaluation/vertex_ai_eval_facade.py", line 29, in <module>
  File ".../google/adk/dependencies/vertexai.py", line 19, in <module>
  File ".../vertexai/preview/rag/__init__.py", line 186, in <module>
UserWarning: The `vertexai.preview.rag` module is deprecated and will be removed in a future version. Please migrate to the `agentplatform` client. For example:

    import agentplatform

    client = agentplatform.Client(project="your-project", location="us-central1")
    client.rag.create_corpus(...)

Without -W error, the same warning appears in pytest's warnings summary of every evaluation test.

Environment Details:

  • ADK Library Version: 2.11.0 (code identical on main d4e092e)
  • Desktop OS: macOS 27.2
  • Python Version: 3.12.8

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: N/A (import-time behaviour)

Optional Information

Regression:
The ADK code is not new. The warning appears with google-cloud-aiplatform 1.163.0, which deprecates vertexai.preview.rag. Once that module is removed, the import in dependencies/vertexai.py would fail outright, taking the evaluation modules with it.

Possible fix:
Drop the eager from vertexai.preview import rag from dependencies/vertexai.py. Let the RAG retrieval tool import vertexai.preview.rag inside the call, where it already defers the import, or migrate it to the agentplatform client the deprecation message names. example_stores, imported the same way, emits no warning today.

Activity

  1. a2105z commented on Oct 5, 2026

    @a2105z
    Contributor

    Taking this.

    @roanny — claiming #7415. dependencies/vertexai.py still does from vertexai.preview import rag at import time, so every evaluation import that only needs vertexai pays the google-cloud-aiplatform deprecation warning (and -W error::UserWarning fails).

    Plan: drop the eager RAG import; expose rag lazily (module __getattr__ or a function-local import) so VertexAiRagRetrieval and its tests still resolve google.adk.dependencies.vertexai.rag, while from ..dependencies.vertexai import vertexai stays quiet. Leave example_stores as-is (no warning today). Not migrating to agentplatform in this PR.

    PR incoming.

  2. a2105z commented on Oct 5, 2026

    @a2105z
    Contributor

    @roanny implemented this as specified: dropped the eager vertexai.preview.rag import from google.adk.dependencies.vertexai, left example_stores in place, and kept the RAG retrieval tool importing vertexai.preview.rag only inside run_async. No agentplatform migration in this PR.

    PR: #7417

  3. self-assigned this
    on Oct 6, 2026
  4. llalitkumarrr commented on Oct 7, 2026

    @llalitkumarrr
    Collaborator

    Hello @roanny,

    Thanks for reporting this! We were able to reproduce it with google-adk==2.11.0 and google-cloud-aiplatform>=1.165.0. We checked #7417, it resolves the reported problem. But this does not fully remove ADK's dependency on the deprecated module and VertexAiRagRetrieval still calls vertexai.preview.rag.retrieval_query.

    The long term fix will be to migrate to the agentplatform client.

  5. added theissue type on Oct 7, 2026
  6. added
    core
    on Oct 7, 2026
  7. a2105z commented on Oct 7, 2026

    @a2105z
    Contributor

    Let me try to fix that in my PR.

  8. added a commit that references this issue on Oct 7, 2026
    6854b88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

core

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions