Repository navigation
Feature Request: Native AFC & Multi-Tool Combination Support (Built-in Grounding + Custom Python Callables) on Vertex AI #5772
Description
Feature Request: Native AFC & Multi-Tool Combination Support (Built-in Grounding + Custom Python Callables) on Vertex AI
Please make sure you read the contribution guide and file the issues in the right place.
Contribution guide.
🔴 Required Information
Please ensure all items in this section are completed to allow for efficient triaging. Requests without complete information may be rejected / deprioritized. If an item is not applicable to you - please mark it as N/A
Is your feature request related to a specific problem?
Yes. When building agentic workflows in ADK 2.0.0, developers frequently need to mix built-in server-side grounding tools (like google_maps_grounding or google_search) with custom client-side Python callables in a single agent.
Currently, doing so on the Vertex AI backend causes the underlying google-genai SDK client validator to automatically disable Automatic Function Calling (AFC) and log a repetitive, confusing RuntimeWarning on every single model turn:
Tools at indices [1] are not compatible with automatic function calling (AFC).
AFC is disabled. If AFC is intended, please include python callables in the tool
list, and do not include function declaration and MCP server in the tool list.
Although the ADK framework successfully bypasses this SDK block by using its own custom Manual Function Calling (MFC) history-circulation loop inside InMemoryRunner (allowing the execution to complete successfully on single-region endpoints like us-central1), the warning creates substantial console noise for ADK developers, and completely breaks native AFC capability for direct GenAI SDK developers.
Describe the Solution You'd Like
We would like native support for mixing built-in grounding search tools and custom client-side callable function tools cleanly without warnings or disabled AFC.
Proposed Solutions:
-
In the
google-genaiPython SDK:- Update
find_afc_incompatible_tool_indexes(): Modify the validator (google/genai/_extra_utils.py:L121) to keep client-side AFC active for customFunctionDeclarationsas long as the executable Python callables are registered in the client's localfunction_map. - Allow
include_server_side_tool_invocationson Vertex AI: Permit this context-circulation configuration flag on Vertex AI (models.py:L4135inside_ToolConfig_to_vertex()) for Gemini 3 models on thev1beta1endpoint, rather than hardcoding a client-sideValueErrorcrash.
- Update
-
In the
google-adkPython SDK:- Grounding Bypass Sub-agent Wrapper: Create a
GoogleMapsGroundingAgentToolclass that automatically wrapsgoogle_maps_groundinginside an isolated sub-agent tool under the hood whenbypass_multi_tools_limit=Trueis specified (identical to how the ADK currently bypasses the limit for the standardGoogleSearchToolinllm_agent.py:L149).
- Grounding Bypass Sub-agent Wrapper: Create a
Impact on your work
This feature is important for enabling clean, warning-free enterprise agentic implementations on Vertex AI. Bypassing this client-side warning will significantly improve the developer experience and adoption when building mixed-tool workflows (combining built-in search grounding and custom business tools) under the ADK 2.0 framework.
Willingness to contribute
No, but we are highly interested in collaborating, providing additional logs, and validating potential preview/beta fixes in our Google Cloud workspaces.
🟡 Recommended Information
Describe Alternatives You've Considered
Alternative A: The Context Injection Pattern
- What we did: Fetched the custom data (such as Client IP or CRM profiles) locally in Python inside
run.pyprior to calling the agent, and injected it as text context (e.g.,[Client IP: X.X.X.X]). - Why it's not ideal: While this works and completely avoids warning logs, it strips the model of its agentic autonomy. The model cannot dynamically decide when to call the custom tool mid-workflow based on conversation logic.
Alternative B: ADK's Manual Interception (MFC Fallback)
- What we did: Let the ADK
Runnermanually intercept thefunction_calland route thefunction_responseloop. - Why it's not ideal: While it executes successfully on single-region endpoints (like
us-central1), it floods the console logs with repetitive, multi-line SDK compatibility warning blocks on every query turn.
Proposed API / Implementation
In google.adk.tools, we would like to be able to initialize the maps grounding tool with a bypass flag:
from google.adk.tools import google_maps_grounding
# Automatically wraps maps grounding inside a sub-agent tool under the hood
google_maps_grounding.bypass_multi_tools_limit = TrueThis should be handled in google/adk/agents/llm_agent.py similarly to the standard GoogleSearchTool logic:
# Proposed addition inside _convert_tool_union_to_tools() in llm_agent.py:
if multiple_tools and isinstance(tool_union, GoogleMapsGroundingTool):
from ..tools.google_maps_grounding_agent_tool import create_maps_agent
from ..tools.google_maps_grounding_agent_tool import GoogleMapsGroundingAgentTool
maps_tool = cast(GoogleMapsGroundingTool, tool_union)
if maps_tool.bypass_multi_tools_limit:
return [GoogleMapsGroundingAgentTool(create_maps_agent(model))]Additional Context
ADK & GenAI Environment Details:
- ADK Library Version:
2.0.0(GA) - GenAI SDK Version:
1.75.0 - Python Version:
3.13 - Desktop OS: Linux
- Model:
gemini-3.5-flash(Vertex AI, us multi-region)
Live timing logs on the 'us' multi-region endpoint showing the successful manual intercept loop working despite the disabled AFC warning:
Tools at indices [1] are not compatible with automatic function calling (AFC).
AFC is disabled. If AFC is intended, please include python callables in the tool
list, and do not include function declaration and MCP server in the tool list.
⚡ 🗺️ Google Maps Grounding Retrieval (+6.97s)
[DATABASE LOG] Saving: The Pink Door (4.6★) at 1919 Post Alley, Seattle, WA 98101, USA
⚡ 🧠 concierge_agent (function_response) (+0.00s)
⚡ 🧠 concierge_agent (function_call) (+2.12s)
⚡ 🧠 concierge_agent (function_response) (+0.13s)
⚡ 🏁 Response Synthesis & Completion (+4.64s)
Activity
klateefa commentedon May 21, 2026
@avadlapatla Thanks for the update. The request is currently being reviewed by our team, and I will let you know if anything further is needed. Thank you for your understanding.
DeanChensj commentedon Oct 13, 2026
Thank you for the detailed report and reproduction steps!
Here is how ADK handles combining built-in grounding tools with custom Python function tools, and why you saw the two behaviors described in the issue:
Native Multi-Tool Combination (Built-in Grounding + Custom Tools) on Gemini 3+:
In
src/google/adk/utils/model_name_utils.py(is_gemini_3_or_above) andsrc/google/adk/flows/llm_flows/extensions/_agent_transfer.py, Gemini 3+ models natively support combining built-in grounding tools (such asGoogleSearchTool,VertexAiSearchTool,EnterpriseWebSearchTool, andGoogleMapsGroundingTool) with custom Python function declarations in the same request without needing a wrapper sub-agent.function_declarationsin a singleGenerateContentcall unless the built-in tool is isolated in a sub-agent orAgentTool(which is whatGoogleSearchTool(bypass_multi_tools_limit=True)andVertexAiSearchTool(bypass_multi_tools_limit=True)do under the hood, or you can wrap an agent withgoogle_maps_groundinginsideAgentTool(agent=maps_agent)).Why
google-genailogged the AFC warning:The warning
Tools at indices [1] are not compatible with automatic function calling (AFC). AFC is disabled.comes from the underlyinggoogle-genaiSDK when raw Python callables are passed insideGenerateContentConfig(tools=[...])alongside atypes.Tool. In ADK, custom Python callables should be passed toLlmAgent(tools=[...])(notgenerate_content_config.tools), because ADK's ownBaseLlmFloworchestrates the tool-execution loop (_functions.py) rather than relying ongoogle-genai's client-side AFC loop.We are closing this issue with the above solution. Please feel free to reopen it if you still encounter any issues when registering your tools on
LlmAgent(tools=[...])!github-actions commentedon Oct 13, 2026
Are you satisfied with the resolution of your issue?
Yes
No