adk-samples
adk-samples copied to clipboard
fix issue #676 : add defensive check to ensure call_analytics_agent is always in tools list
Fixed issue where call_analytics_agent could be missing from tools_dict after multiple interactions in the data-science agent.
Changes:
- Added defensive check in get_root_agent() to ensure call_analytics_agent is always present in the tools list before creating the agent
- Added debug logging to track which tools are being registered - Fixed typo in tools.py module docstring: "Sampmles" → "Samples"
The defensive check ensures that even if there's any issue with tool list construction, call_analytics_agent will always be included. This prevents the "Function call_analytics_agent is not found in the tools_dict" error that occurred after multiple interactions.
The root cause appears to be that ADK's internal tools_dict might lose track of the tool reference in certain edge cases. This fix ensures the tool is always present when the agent is created.