Skip to content

Conversation

@yodeee9
Copy link

@yodeee9 yodeee9 commented Jan 29, 2026

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:

  • Sync tried to reconcile local ADK tools with non-ADK remote tools, as if they were managed by ADK.
  • Non-ADK tools could be considered for update/delete during sync, even though ADK did not create them.

Root Cause

In agent.py, _sync_function_tools_to_remote() used every tool returned by find_tools() that had tool_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 restrict remote_func_tools to tools that:

  1. Have lifecycle_state == "ACTIVE", and
  2. Have ADK freeform tags (i.e. FREEFORM_TAGS keys are present in freeform_tags), and
  3. Have tool_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.

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.
Copilot AI review requested due to automatic review settings January 29, 2026 23:56
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jan 29, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant