Commit 0b73a69
fix: Handle App objects in eval and graph endpoints
Merge #3060
## Description
Fixes #3059
This PR fixes two endpoints in `adk web` that fail when using App objects instead of bare agents.
## Changes
- **Eval execution endpoint** (line ~969): Extract root_agent from App objects before passing to LocalEvalService
- **Graph visualization endpoint** (line ~1308): Extract root_agent from App objects before graph operations
Both endpoints now properly handle both BaseAgent and App objects by checking the type and extracting `.root_agent` when needed.
## Testing Plan
### Manual E2E Testing with ADK Web
Tested with an App object that includes context caching:
```python
from google.adk.apps import App
from google.adk.agents import LlmAgent
root_agent = LlmAgent(name="MyAgent", model="gemini-1.5-pro-002")
app = App(
name="my_agent",
root_agent=root_agent,
context_cache_config=ContextCacheConfig(...)
)
```
**Before fix:**
- Graph visualization failed (tried to call agent methods on App object)
- Eval execution failed (LocalEvalService received App instead of agent)
**After fix:**
- Graph visualization works correctly
- Eval execution works correctly
- Both endpoints properly extract root_agent from App objects
## Checklist
- [x] Code follows project style (autoformat.sh passed)
- [x] Changes are focused and minimal
- [x] Issue #3059 created and referenced
- [x] Manual E2E testing completed
COPYBARA_INTEGRATE_REVIEW=#3060 from ejfn:ejfn/bugfix-app-object-endpoints 01c3019
PiperOrigin-RevId: 8217469101 parent ee39a89 commit 0b73a69
1 file changed
+11
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
486 | 486 | | |
487 | 487 | | |
488 | 488 | | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
489 | 495 | | |
490 | 496 | | |
491 | 497 | | |
| |||
933 | 939 | | |
934 | 940 | | |
935 | 941 | | |
936 | | - | |
937 | | - | |
938 | | - | |
| 942 | + | |
| 943 | + | |
939 | 944 | | |
940 | 945 | | |
941 | 946 | | |
| |||
1096 | 1101 | | |
1097 | 1102 | | |
1098 | 1103 | | |
1099 | | - | |
| 1104 | + | |
| 1105 | + | |
1100 | 1106 | | |
1101 | 1107 | | |
1102 | 1108 | | |
| |||
1437 | 1443 | | |
1438 | 1444 | | |
1439 | 1445 | | |
1440 | | - | |
1441 | | - | |
1442 | | - | |
1443 | | - | |
1444 | | - | |
1445 | | - | |
1446 | | - | |
| 1446 | + | |
1447 | 1447 | | |
1448 | 1448 | | |
1449 | 1449 | | |
| |||
0 commit comments