Prevent Web UI from displaying non-agent directories#5303
Prevent Web UI from displaying non-agent directories#5303gitsofaryan wants to merge 2 commits intogoogle:mainfrom
Conversation
|
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. |
|
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! |
|
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 |
Resolves #5299
Description
This PR fixes an issue where the Web UI and underlying
AgentLoaderincorrectly listed non-agent directories (such asutils/,tmp/, etc.) in the agent discovery selector, resulting in a fractured user experience andValueErrorloading errors.Changes Made
AgentLoader.list_agents()insrc/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.detailedquery parameter in the/list-appsFastAPI endpoint (src/google/adk/cli/adk_web_server.py) fromFalsetoTrue. Becausedetailed=Trueimplicitly 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.tests/unittests/cli/test_fast_api.pyto ensure legacy assertions still evaluate?detailed=falseappropriately while validating the newly updated endpoint default.test_list_agents_ignores_non_agent_directoriestotests/unittests/cli/utils/test_agent_loader.pythat identically emulates the Minimal Reproduction Code provided in the issue, ensuring we properly exclude irrelevant directories.Testing Instructions
pytest tests/unittests/cli/utils/test_agent_loader.py&pytest tests/unittests/cli/test_fast_api.py).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.