Getting Import error in vertexai package on AgentEvaluator run
I'm trying to run eval cases using pytest using Agent Evaluator. But the test is throwing error saying "cannot import name 'types' from 'vertextai'
Full error
============================================================= FAILURES ============================================================= _____________________________________________________________ test_all _____________________________________________________________
@pytest.mark.asyncio
async def test_all():
"""Test the agent's basic ability on a few examples."""
await AgentEvaluator.evaluate(
"console_agent",
str(pathlib.Path(__file__).parent / "data/DataAgent.evalset.json"),
num_runs=1,
)
eval/test_eval.py:34:
/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/google/adk/evaluation/agent_evaluator.py:219: in evaluate await AgentEvaluator.evaluate_eval_set( /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/google/adk/evaluation/agent_evaluator.py:145: in evaluate_eval_set metric_evaluator = AgentEvaluator._get_metric_evaluator( /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/google/adk/evaluation/agent_evaluator.py:392: in _get_metric_evaluator from .response_evaluator import ResponseEvaluator
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations
from typing import Optional
from typing_extensions import override
from vertexai import types as vertexai_types E ImportError: cannot import name 'types' from 'vertexai' (/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/vertexai/init.py)
/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/google/adk/evaluation/response_evaluator.py:20: ImportError
Current Setup google-adk>=1.6.1 uvicorn>=0.18.0 google-genai>=0.3.0 aiohttp>=3.8.0 pytest-asyncio>=0.21.0 Python : 3.13.5
@hangfei
Traceback (most recent call last):
File "/Users/Documents/.venv/lib/python3.12/site-packages/google/adk/cli/cli_eval.py", line 192, in run_evals
metric_evaluator = _get_evaluator(eval_metric)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Documents/.venv/lib/python3.12/site-packages/google/adk/cli/cli_eval.py", line 263, in _get_evaluator
from ..evaluation.response_evaluator import ResponseEvaluator
File "/Users/Documents/.venv/lib/python3.12/site-packages/google/adk/evaluation/response_evaluator.py", line 20, in
I am not able to reproduce the issue on my end. I tried with python 3.11, 3.12 and 3.13.
can you confirm that you have ran this command as well (basically install eval dependencies as well):
pip install google-adk[eval]
If the issue persist, can you please share the entire stack trace.
Thank you for reporting the issue!
after I run pip install google-adk[eval], it will still throw me error to let me install google-adk[eval]
same here. can't run evals
ImportError: cannot import name 'types' from 'vertexai'
running
uv run adk eval '/Users/alireza/agent.git.worktrees/add-test-agent/debug_agent' '/Users/alireza/agent.git.worktrees/add-test-agent/debug_agent/eval/conditions.evalset.json'
Update: after installing "google-adk[eval]==1.7.0" it worked
When running from source, what worked for me was updating the poetry dependencies list with a version that supports types. "google-cloud-aiplatform[evaluation,agent-engines]>=1.105.0",
Eval is not a part of core ADK. One needs to run the following command for running evals:
pip install google-adk[eval]