Skip to content

Prevent Web UI from displaying non-agent directories - #5303

Closed
gitsofaryan wants to merge 5 commits into
google:mainfrom
gitsofaryan:main
Closed

gitsofaryan wants to merge 5 commits into
google:mainfrom
gitsofaryan:main

Conversation

@gitsofaryan

Copy link
Copy Markdown

Resolves #5299

Description

This PR fixes an issue where the Web UI and underlying AgentLoader incorrectly listed non-agent directories (such as utils/, tmp/, etc.) in the agent discovery selector, resulting in a fractured user experience and ValueError loading errors.

Changes Made

  1. AgentLoader Root Fix: Updated AgentLoader.list_agents() in src/google/adk/cli/utils/agent_loader.py. It now explicitly verifies that directories contain a recognized agent definition (root_agent.yaml, agent.py, or __init__.py) before appending them to the results list.
  2. Endpoint Default: Changed the default value of the detailed query parameter in the /list-apps FastAPI endpoint (src/google/adk/cli/adk_web_server.py) from False to True. Because detailed=True implicitly leverages robust object instantiations, it functions as an immediate stop-gap backward-compatible fix for the Web UI without needing to force frontend compiled rebuilds.
  3. Test Coverage:
    • Modified tests/unittests/cli/test_fast_api.py to ensure legacy assertions still evaluate ?detailed=false appropriately while validating the newly updated endpoint default.
    • Appended a new unit test test_list_agents_ignores_non_agent_directories to tests/unittests/cli/utils/test_agent_loader.py that identically emulates the Minimal Reproduction Code provided in the issue, ensuring we properly exclude irrelevant directories.

Testing Instructions

  1. Run local unittests (pytest tests/unittests/cli/utils/test_agent_loader.py & pytest tests/unittests/cli/test_fast_api.py).
  2. Locally spin up the Web UI using adk web . from a directory populated with both valid agent and non-agent subdirectories and verify that only the valid agents populate within the dropdown menu.

@google-cla

google-cla Bot commented Apr 13, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@adk-bot adk-bot added web [Component] This issue will be transferred to adk-web core [Component] This issue is related to the core interface and implementation labels Apr 13, 2026
@adk-bot

adk-bot commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

Response from ADK Triaging Agent

Hello @gitsofaryan, thank you for your contribution!

Before we can review your pull request, you'll need to sign a Contributor License Agreement (CLA). You can find more information and sign the CLA at https://cla.developers.google.com/.

For more details on our contribution process, please review our contribution guidelines.

Thanks!

@rohityan rohityan self-assigned this Apr 13, 2026
@rohityan rohityan added request clarification [Status] The maintainer need clarification or more information from the author and removed core [Component] This issue is related to the core interface and implementation labels Apr 13, 2026
@rohityan

Copy link
Copy Markdown
Collaborator

Hi @gitsofaryan , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Please fix formatting errors by running autoformat.sh

@gitsofaryan

Copy link
Copy Markdown
Author

@rohityan thanks, PTAL!

@gitsofaryan

Copy link
Copy Markdown
Author

@rohityan could you please review my PR!

@GWeale GWeale self-assigned this Aug 28, 2026
@GWeale
GWeale self-requested a review August 28, 2026 23:02
@GWeale

GWeale commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

the loader fix landed separately in caac070, list_agents() skips any directory without agent.py, root_agent.yaml or init.py, the same set you had. that shipped in v2.8.0 and the v1 line still lists them, so file a backport request if you need it there. the /list-apps detailed default flip wasn't taken since it changes the response shape for existing callers, worth its own issue.

@GWeale GWeale closed this Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

request clarification [Status] The maintainer need clarification or more information from the author web [Component] This issue will be transferred to adk-web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web UI Agent Discovery Returns Non-Agent Directories

4 participants