Describe the Bug:
When an invalid app_name is provided to API endpoints such as /run and /apps/{app_name}/app-info, the backend raises a ValueError from load_agent, which is not handled at the API layer. This results in a 500 Internal Server Error instead of a controlled client error.
Steps to Reproduce:
- Install the project and start the API server:
python -m google.adk.cli api_server
Send a request with an invalid app_name:
curl -X POST http://127.0.0.1:8000/run \
-H "Content-Type: application/json" \
-d '{
"app_name": "INVALID",
"user_id": "u1",
"session_id": "s1",
"message": "hello"
}'
Observe the response and server logs.
Expected Behavior:
The API should return a controlled client error (e.g., 404 Not Found or 400 Bad Request) for invalid app_name values.
Observed Behavior:
The server returns:
HTTP/1.1 500 Internal Server Error
Server logs show:
ValueError: Agent not found: 'INVALID'
Environment Details:
ADK Library Version (pip show google-adk): N/A (tested from source)
Desktop OS: Windows
Python Version (python -V): 3.11
Model Information:
Are you using LiteLLM: No
Which model is being used: N/A
🟡 Optional Information
Regression:
Not tested.
Logs:
ValueError: Agent not found: 'INVALID'
Screenshots / Video:
N/A
Additional Context:
The issue appears to originate from unhandled exceptions in load_agent(app_name) propagating to the API layer without validation or proper error handling.
Minimal Reproduction Code:
Not applicable (reproducible via API request)
How often has this issue occurred?:
Always (100%)
This will render exactly like your screenshot UI expects
Describe the Bug:
When an invalid
app_nameis provided to API endpoints such as/runand/apps/{app_name}/app-info, the backend raises aValueErrorfromload_agent, which is not handled at the API layer. This results in a500 Internal Server Errorinstead of a controlled client error.Steps to Reproduce:
Send a request with an invalid app_name:
Observe the response and server logs.
Expected Behavior:
The API should return a controlled client error (e.g., 404 Not Found or 400 Bad Request) for invalid app_name values.
Observed Behavior:
The server returns:
Server logs show:
ValueError: Agent not found: 'INVALID'Environment Details:
Model Information:
Are you using LiteLLM: No
Which model is being used: N/A
🟡 Optional Information
Regression:
Not tested.
Logs:
ValueError: Agent not found: 'INVALID'
Screenshots / Video:
N/A
Additional Context:
The issue appears to originate from unhandled exceptions in load_agent(app_name) propagating to the API layer without validation or proper error handling.
Minimal Reproduction Code:
Not applicable (reproducible via API request)
How often has this issue occurred?:
Always (100%)
This will render exactly like your screenshot UI expects