adk-docs icon indicating copy to clipboard operation
adk-docs copied to clipboard

Bug: `get_fast_api_app()` fails with App class - "ValueError: Unsupported tool type"

Open AlfredoJF opened this issue 4 months ago • 5 comments

Describe the bug get_fast_api_app() crashes when agent modules contain the new App class (introduced in ADK 1.14.0+) during graph visualisation with "ValueError: Unsupported tool type".

To Reproduce

Steps to reproduce the behaviour:

  1. Create agent module with both root_agent and App objects
  2. Use get_fast_api_app() to serve the agent for Google Cloud Run deployment following Deploy - Cloud Run - Python - gcloud - CLI
  3. Access the graph visualisation endpoint
  4. See error: ValueError: Unsupported tool type

Minimal reproduction code:

# agent/agent.py
from google.adk.agents.llm_agent import LlmAgent
from google.adk.apps import App
from google.adk.plugins.base_plugin import BasePlugin

class MyPlugin(BasePlugin):
    pass

root_agent = LlmAgent(model="gemini-2.0-flash", name="agent", ...)
app = App(name="app", root_agent=root_agent, plugins=[MyPlugin()])
# main.py  
from google.adk.cli.fast_api import get_fast_api_app
app = get_fast_api_app(agents_dir="./agent", ...)

Expected behaviour get_fast_api_app() should either handle App objects properly or ignore them during agent discovery. The web interface should work without crashing the graph visualisation endpoint.

Screenshots

Desktop (please complete the following information):

  • OS: macOS
  • Python version(python -V): 3.13
  • ADK version(pip show google-adk): google-adk==1.14.1

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used(e.g. gemini-2.5-pro): gemini-2.5-flash

Additional context This is a regression introduced in ADK 1.14.0 with the new App class. The issue occurs in agent_graph.py line 77 where get_node_name() doesn't recognise App class objects, only LlmAgent/Agent types.

Workarounds tested:

  • Renaming App variable ❌
  • Standard project structure ❌
  • Using only root_agent ❌ (plugins require App class)

This affects users upgrading to ADK 1.14.0+ who need App class features (plugins, multi-agent, etc.).

Potential solutions:

  1. Update get_node_name() to handle App objects
  2. Filter out App objects in agent discovery
  3. Add full App class support to graph visualisation

AlfredoJF avatar Sep 16 '25 11:09 AlfredoJF

I am also using the same method to run ADK and encountered an error:

2025-09-17 18:33:38 - google_adk.google.adk.cli.adk_web_server - ERROR - adk_web_server:event_generator:1076 - Error in event_generator: Session not found: 3183c11a-285f-4bd0-909d-d6db704d7759 Traceback (most recent call last): File "/Users/mac/Desktop/data_analysis_agent/.venv/lib/python3.12/site-packages/google/adk/cli/adk_web_server.py", line 1066, in event_generator async for event in agen: File "/Users/mac/Desktop/data_analysis_agent/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 314, in run_async async for event in agen: File "/Users/mac/Desktop/data_analysis_agent/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 275, in _run_with_trace raise ValueError(f'Session not found: {session_id}') ValueError: Session not found: 3183c11a-285f-4bd0-909d-d6db704d7759

ITMeow avatar Sep 17 '25 10:09 ITMeow

@wyf7107 I'll take a look at this

kevinkassimo avatar Oct 27 '25 23:10 kevinkassimo

I am also using the same method to run ADK and encountered an error:

2025-09-17 18:33:38 - google_adk.google.adk.cli.adk_web_server - ERROR - adk_web_server:event_generator:1076 - Error in event_generator: Session not found: 3183c11a-285f-4bd0-909d-d6db704d7759 Traceback (most recent call last): File "/Users/mac/Desktop/data_analysis_agent/.venv/lib/python3.12/site-packages/google/adk/cli/adk_web_server.py", line 1066, in event_generator async for event in agen: File "/Users/mac/Desktop/data_analysis_agent/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 314, in run_async async for event in agen: File "/Users/mac/Desktop/data_analysis_agent/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 275, in _run_with_trace raise ValueError(f'Session not found: {session_id}') ValueError: Session not found: 3183c11a-285f-4bd0-909d-d6db704d7759

With the latest version, I was able to reproduce this one, but not the one described in the original issue (maybe it is already fixed?)

kevinkassimo avatar Oct 28 '25 00:10 kevinkassimo

I am also using the same method to run ADK and encountered an error:

2025-09-17 18:33:38 - google_adk.google.adk.cli.adk_web_server - ERROR - adk_web_server:event_generator:1076 - Error in event_generator: Session not found: 3183c11a-285f-4bd0-909d-d6db704d7759 Traceback (most recent call last): File "/Users/mac/Desktop/data_analysis_agent/.venv/lib/python3.12/site-packages/google/adk/cli/adk_web_server.py", line 1066, in event_generator async for event in agen: File "/Users/mac/Desktop/data_analysis_agent/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 314, in run_async async for event in agen: File "/Users/mac/Desktop/data_analysis_agent/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 275, in _run_with_trace raise ValueError(f'Session not found: {session_id}') ValueError: Session not found: 3183c11a-285f-4bd0-909d-d6db704d7759

Actually this happens to me only when I don't have __init__.py that imports the agent. Once importing, this error goes away.

kevinkassimo avatar Oct 28 '25 16:10 kevinkassimo

@joefernandez to make sure this(init) is covered in the doc.

hangfei avatar Nov 08 '25 15:11 hangfei