Repository navigation
[BUG]: Issue with ADK LLM Agent using VertexAiSearchTool - incompatibility between tool and output_schema when applied together #3025
Copy link
Copy link
Closed
Labels
tools[Component] This issue is related to tools[Component] This issue is related to tools
Description
Describe the bug
The VertexAiSearchTool imported from google.adk.tools is not working when an output_schema for the LlmAgent is defined.
To Reproduce
Steps to reproduce the behavior:
-
Define a LLM Agent with one tool VertexAiSearchTool
-
Define a pydantic schema class and provide that as output_schema to the LLMAgent
-
Run ADK web and provide a query
Error Stack Trace
2025-09-25 12:24:06,188 - ERROR - adk_web_server.py:1076 - Error in event_generator: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Multiple tools are supported only when they are all search tools.', 'status': 'INVALID_ARGUMENT'}}
Traceback (most recent call last):
File "venv/lib/python3.12/site-packages/google/adk/cli/adk_web_server.py", line 1066, in event_generator
async for event in agen:
File "venv/lib/python3.12/site-packages/google/adk/runners.py", line 314, in run_async
async for event in agen:
File "venv/lib/python3.12/site-packages/google/adk/runners.py", line 310, in _run_with_trace
async for event in agen:
File "venv/lib/python3.12/site-packages/google/adk/runners.py", line 354, in _exec_with_plugin
async for event in agen:
File "venv/lib/python3.12/site-packages/google/adk/runners.py", line 304, in execute
async for event in agen:
File "venv/lib/python3.12/site-packages/google/adk/agents/base_agent.py", line 248, in run_async
async for event in agen:
File "venv/lib/python3.12/site-packages/google/adk/agents/base_agent.py", line 238, in _run_with_trace
async for event in agen:
File "venv/lib/python3.12/site-packages/google/adk/agents/llm_agent.py", line 288, in _run_async_impl
async for event in agen:
File "venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 401, in run_async
async for event in agen:
File "venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 437, in _run_one_step_async
async for llm_response in agen:
File "venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 767, in _call_llm_async
async for event in agen:
File "venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 751, in _call_llm_with_tracing
async for llm_response in agen:
File "venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 943, in _run_and_handle_error
raise model_error
File "venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 927, in _run_and_handle_error
async for response in agen:
File "venv/lib/python3.12/site-packages/google/adk/models/google_llm.py", line 156, in generate_content_async
response = await self.api_client.aio.models.generate_content(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.12/site-packages/google/genai/models.py", line 8289, in generate_content
response = await self._generate_content(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.12/site-packages/google/genai/models.py", line 7124, in _generate_content
response = await self._api_client.async_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.12/site-packages/google/genai/_api_client.py", line 1324, in async_request
result = await self._async_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.12/site-packages/google/genai/_api_client.py", line 1269, in _async_request
return await self._async_retry( # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 111, in __call__
do = await self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.12/site-packages/tenacity/_utils.py", line 99, in inner
return call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.12/site-packages/tenacity/__init__.py", line 418, in exc_check
raise retry_exc.reraise()
^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.12/site-packages/tenacity/__init__.py", line 185, in reraise
raise self.last_attempt.result()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "anaconda3/lib/python3.12/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "anaconda3/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 114, in __call__
result = await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.12/site-packages/google/genai/_api_client.py", line 1214, in _async_request_once
await errors.APIError.raise_for_async_response(response)
File "venv/lib/python3.12/site-packages/google/genai/errors.py", line 159, in raise_for_async_response
raise ClientError(status_code, response_json, response)
google.genai.errors.ClientError: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Multiple tools are supported only when they are all search tools.', 'status': 'INVALID_ARGUMENT'}}
Expected behavior
- The adk should not error out saying all tools should be retrieval based when there is only one Vertex_ai_search_tool defined
Screenshots
Desktop (please complete the following information):
-
OS: Amazon Linux 2 cpe:2.3:o:amazon:amazon_linux:2
-
Python version(python -V): 3.12.11
-
ADK version(pip show google-adk): 1.14.1
Model Information:
-
Are you using LiteLLM: No
-
Which model is being used: gemini-2.5-flash
Additional context
- The flow works fine when the VertexAISearchTool is wrapped into an AgentTool,
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
tools[Component] This issue is related to tools[Component] This issue is related to tools
Activity
boyangsvl commentedon Oct 8, 2025
This will be fixed in the upcoming release.
Jacksunwei commentedon Oct 27, 2025
This issue has been fixed in v1.17.0 (released October 22, 2025).
What was fixed: The
VertexAiSearchToolnow includes abypass_multi_tools_limitparameter (defaults toFalse), which allows it to work natively withoutput_schemaand other tools without triggering the "Multiple tools are supported only when they are all search tools" error.To use the fix: Upgrade to ADK v1.17.0 or later:
Your original code should now work without needing to wrap the tool in an
AgentTool.Related commits:
Closing as fixed. Please reopen if you encounter any issues after upgrading.
prashu318 commentedon Nov 3, 2025
Hello,
Even after passing bypass_multitool flag as true, the vertexaisearchtool doesn’t seem to support output_schema. Also, the bypass flag is allowed only when we use any other search tool within the list. In our case the only tool being used is vertex search tool. Please let us know if this is a bug which is still unresolved.
prashu318 commentedon Nov 3, 2025
We used ADK version 1.17, discovery engine version 0.15 and Google-genai v1.47.0
@Jacksunwei
desibandhu commentedon Nov 11, 2025
Facing the same issue as reported by @prashu318 .
@Jacksunwei request you to please reopen this issue and investigate.
I am on google-adk - 1.18.0