Repository navigation
Description
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:
pip install "google-adk[eval]==2.11.0" "google-cloud-aiplatform==1.163.0".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
maind4e092e) - 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
a2105z commentedon Oct 5, 2026
Taking this.
@roanny — claiming #7415.
dependencies/vertexai.pystill doesfrom vertexai.preview import ragat import time, so every evaluation import that only needsvertexaipays thegoogle-cloud-aiplatformdeprecation warning (and-W error::UserWarningfails).Plan: drop the eager RAG import; expose
raglazily (module__getattr__or a function-local import) soVertexAiRagRetrievaland its tests still resolvegoogle.adk.dependencies.vertexai.rag, whilefrom ..dependencies.vertexai import vertexaistays quiet. Leaveexample_storesas-is (no warning today). Not migrating toagentplatformin this PR.PR incoming.
a2105z commentedon Oct 5, 2026
@roanny implemented this as specified: dropped the eager
vertexai.preview.ragimport fromgoogle.adk.dependencies.vertexai, leftexample_storesin place, and kept the RAG retrieval tool importingvertexai.preview.ragonly insiderun_async. Noagentplatformmigration in this PR.PR: #7417
llalitkumarrr commentedon Oct 7, 2026
Hello @roanny,
Thanks for reporting this! We were able to reproduce it with
google-adk==2.11.0andgoogle-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 andVertexAiRagRetrievalstill callsvertexai.preview.rag.retrieval_query.The long term fix will be to migrate to the
agentplatformclient.a2105z commentedon Oct 7, 2026
Let me try to fix that in my PR.
fix(evaluation): stop loading deprecated Vertex RAG on eval import