Commit c397b48
fix: add Google ADK agent invocation support for run_async/run_live methods
Critical fix for Google ADK agents which use run_async() and run_live()
methods instead of __call__() for agent invocation.
Problem:
- Google ADK LlmAgent class is not callable
- Previous code assumed all agents could be called via executor: self.agent(query)
- This caused TypeError: 'LlmAgent' object is not callable
Solution:
- Check for run_async() method first (Google ADK async interface)
- Fall back to callable check for standard agents
- Support run_live() as secondary fallback for Google ADK
- Add proper error message for unsupported agent types
Response Parsing:
- Added support for Google ADK response format (.text attribute)
- Maintains backward compatibility with existing agent formats
Changes:
- src/basic_agent_chat_loop/chat_loop.py:
- Updated _stream_agent_response() to detect and call Google ADK methods
- Added response.text parsing for Google ADK responses
- Improved error handling with descriptive TypeError
Testing:
- ✅ All 320 tests passing
- ✅ Google ADK agent tests passing
- ✅ Backward compatibility maintained
Fixes: #google-adk-callable-error
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent f23432f commit c397b48
1 file changed
Lines changed: 28 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1409 | 1409 | | |
1410 | 1410 | | |
1411 | 1411 | | |
1412 | | - | |
1413 | | - | |
1414 | | - | |
1415 | | - | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
1416 | 1433 | | |
1417 | 1434 | | |
1418 | 1435 | | |
| |||
1426 | 1443 | | |
1427 | 1444 | | |
1428 | 1445 | | |
1429 | | - | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
1430 | 1451 | | |
1431 | 1452 | | |
1432 | 1453 | | |
| |||
1438 | 1459 | | |
1439 | 1460 | | |
1440 | 1461 | | |
| 1462 | + | |
| 1463 | + | |
1441 | 1464 | | |
1442 | 1465 | | |
1443 | 1466 | | |
| |||
0 commit comments