Repository navigation
Prevent Web UI from displaying non-agent directories - #5303
gitsofaryan wants to merge 5 commits into
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 |
|
@rohityan thanks, PTAL! |
|
@rohityan could you please review my PR! |
|
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. |
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.