Skip to content

adk web: Multiple endpoints fail with App objects #3059

@ejfn

Description

@ejfn

Describe the bug
Multiple adk web endpoints fail when using App objects instead of bare agents because they don't extract .root_agent from the App.

Affected locations:

  1. Graph visualization endpoint (get_event_graph, line ~1308)
  2. Eval execution endpoint (run_evals, line ~969)

To Reproduce

  1. Create an agent module that exports an App object:
from google.adk.apps import App
from google.adk.agents import LlmAgent

root_agent = LlmAgent(name="MyAgent", model="gemini-2.0-flash-exp")
app = App(name="MyApp", root_agent=root_agent)
  1. Start the web server:
adk web ./agents/
  1. Try to view graph visualization or run evals
  2. Endpoints fail because code expects load_agent() to return a BaseAgent but it returns an App

Expected behavior
adk web should handle both BaseAgent and App objects by extracting .root_agent when needed.

Fix pattern:

agent_or_app = self.agent_loader.load_agent(app_name)
# Extract root_agent if we loaded an App
if isinstance(agent_or_app, App):
    root_agent = agent_or_app.root_agent
else:
    root_agent = agent_or_app

Desktop:

  • OS: Linux (WSL2)
  • Python version: 3.13
  • ADK version: main branch (post commit d5c46e4)

Model Information:

  • Using LiteLLM: No
  • Model: gemini-1.5-pro-002

Metadata

Metadata

Assignees

Labels

bot triaged[Bot] This issue is triaged by ADK botweb[Component] This issue will be transferred to adk-web

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions