Fix ADK tag filtering for function tool sync#825
Open
yodeee9 wants to merge 1 commit intooracle:masterfrom
Open
Fix ADK tag filtering for function tool sync#825yodeee9 wants to merge 1 commit intooracle:masterfrom
yodeee9 wants to merge 1 commit intooracle:masterfrom
Conversation
Sync only considers tools with ADK freeform tags when merging local and remote function tools; tools created outside ADK (e.g. console) are no longer included in the sync list.
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the ADK agent's function tool synchronization logic. Previously, agent.setup() would attempt to sync all remote function-calling tools, including those created outside of ADK (e.g., via the OCI console). This could lead to unintended modifications or deletions of non-ADK tools and made it easier to hit the 20-tool limit in environments where that constraint applies.
Changes:
- Added ADK freeform tag filtering to
_sync_function_tools_to_remote()to match RAG and SQL tool sync behavior - Updated method docstring to clarify that only ADK-tagged tools are considered
- Added inline comment explaining the filtering logic
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
agent.setup()ran function-tool sync (_sync_function_tools_to_remote), it treated all remote function-calling tools as sync targets. That included tools created outside ADK (e.g. in the OCI console or by other clients) that do not have ADK freeform tags (ConfiguredByADK).As a result:
Root Cause
In
agent.py,_sync_function_tools_to_remote()used every tool returned byfind_tools()that hadtool_config_type == "FUNCTION_CALLING_TOOL_CONFIG", without checking ADK ownership. RAG and SQL tool sync already filtered by ADK freeform tags; function tool sync did not.Fix
Function tool sync now uses the same ADK tag filter as RAG and SQL sync. Before calling
_sync_local_and_remote_tools(), we restrictremote_func_toolsto tools that:lifecycle_state == "ACTIVE", andFREEFORM_TAGSkeys are present infreeform_tags), andtool_config_type == "FUNCTION_CALLING_TOOL_CONFIG".Only those remote tools are passed into sync. Tools created outside ADK (e.g. in the console, without ADK tags) are no longer part of the sync list and are left unchanged by ADK.