Skip to content

Dev UI eval reports "Eval module is not installed" for unrelated ModuleNotFoundErrors #8347

In review

Description

@adri0

🔴 Required Information

Describe the Bug:
When an eval is started from the Dev UI (adk web), any ModuleNotFoundError raised while the eval runs is reported as Eval module is not installed, please install via pip install "google-adk[eval]", even when google-adk[eval] is installed. For example, the agent's own agent.py might import a package that isn't installed. The real cause appears only in the server log, so users are told to reinstall something they already have.

The cause is in src/google/adk/cli/dev_server.py, in run_eval (POST /dev/apps/{app_name}/eval-sets/{eval_set_id}/run). The try: ... except ModuleNotFoundError there is meant to guard the lazy imports of the evaluation modules. However, it also covers loading the agent (self.agent_loader.load_agent(app_name)), building the LocalEvalService, inference and metric evaluation.

Steps to Reproduce:

  1. Install ADK with the eval extra: pip install "google-adk[eval]"
  2. Create an agent whose agent.py imports a package that is not installed (see Minimal Reproduction Code below), plus an eval set evalset1.evalset.json in the agent folder.
  3. Start the dev server: adk web agents
  4. Run the eval set from the Dev UI, or call the endpoint directly:
    curl -X POST localhost:8000/dev/apps/badagent/eval-sets/evalset1/run \
      -H 'content-type: application/json' \
      -d '{"eval_metrics":[{"metric_name":"response_match_score","threshold":0.8}]}'

Expected Behavior:
The error points at the real problem: the agent failed to load because some_llm_sdk_not_installed is missing. The "install google-adk[eval]" hint should only appear when the eval
modules themselves can't be imported.

Observed Behavior:
HTTP 400 with a misleading message:

{"detail":"Eval module is not installed, please install via `pip install \"google-adk[eval]\"`."}

The real error is only in the server log:

ERROR - dev_server.py:1156 - Fail to load 'badagent' module. No module named 'some_llm_sdk_not_installed'

Environment Details:

  • ADK Library Version (pip show google-adk): 2.15.0`
  • Desktop OS: macOS 26.7.3
  • Python Version (python -V): Python 3.12.8

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: gemini-2.5-flash (the bug doesn't depend on the model; it's triggered before any model call)

🟡 Optional Information

Regression:
Unknown, not tested on earlier versions.

Logs:

ERROR - dev_server.py:1156 - Fail to load 'badagent' module. No module named 'so
Traceback (most recent call last):
  ...
ModuleNotFoundError: Fail to load 'badagent' module. No module named 'some_llm_sdk_not_installed'

Screenshots / Video:
N/A

Additional Context:

  • The adk eval CLI is not affected: in cli_tools_click.py the same handler wraps only the imports, so errors are reported correctly there. The other places that raise MISSING_EVAL_DEPENDENCIES_MESSAGE (cli_eval.py, agent_evaluator.py, the GEPA optimizers) also wrap only imports.
  • In practice the bug hits users whose agent imports an optional SDK they haven't installed, which can look like "the eval fails when I have no LLM access".
  • Suggested fix: limit the except ModuleNotFoundError in run_eval to the five eval imports at the top of the function and let later errors propagate. Other dev endpoints that load the agent, such as add-session, already let these errors through. I have a patch with a regression test and can open a PR.

Minimal Reproduction Code:

# agents/badagent/__init__.py
from . import agent

# agents/badagent/agent.py
import some_llm_sdk_not_installed  # any package that is not installed

from google.adk.agents import Agent

root_agent = Agent(
    name="badagent", model="gemini-2.5-flash", instruction="Be helpful."
)
// agents/badagent/evalset1.evalset.json
{"eval_set_id": "evalset1", "eval_cases": [{"eval_id": "case1",
  "conversation": [{"invocation_id": "i1",
    "user_content": {"role": "user", "parts": [{"text": "hi"}]},
    "final_response": {"role": "model", "parts": [{"text": "hello"}]}}],
  "session_input": {"app_name": "badagent", "user_id": "u"}}]}

How often has this issue occurred?:

  • Always (100%)

Activity

  1. surajksharma07 commented on Nov 27, 2026

    @surajksharma07
    Collaborator

    @adri0, reproduced on google-adk[eval]==2.15.1 and on main: badagent gets the 400 "Eval module is not installed" while the log shows the real some_llm_sdk_not_installed error. Narrowing the except to the five imports, like #8356 does, fixed it for me.

    Until that lands, a workaround that worked locally is to pass get_fast_api_app a small AgentLoader subclass that re-raises ModuleNotFoundError from load_agent as HTTPException(500, detail=str(e)). The Dev UI then shows the actual missing package. Could you try that on your setup and see if it holds up?

    It might also be worth surfacing the load error text like that in #8356, since right now the fix returns a bare 500.

    One blocker on #8356: the Google CLA check is failing. Could you sign it and give the change a thorough test? Then we can get it reviewed.

  2. added
    eval
    on Nov 29, 2026
  3. added a commit that references this issue on Nov 29, 2026
    ec7b65b
  4. adri0 commented on Nov 29, 2026

    @adri0
    Author

    @surajksharma07 Thanks for reviewing. I checked your workaround, it does work. I added an extra handling of the raised exception so that the 500 shows the missing package correctly. I didn't want to touch _load_agent_or_raise() as it's used by different modules.

    Also addressed the Google CLA issue.

    Could you check again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

eval

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions