Skip to content

[BUG]: Issue with ADK LLM Agent using VertexAiSearchTool - incompatibility between tool and output_schema when applied together #3025

Description

@ctandrewtran

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:

  1. Define a LLM Agent with one tool VertexAiSearchTool

  2. Define a pydantic schema class and provide that as output_schema to the LLMAgent

  3. 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

  1. 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

  1. The flow works fine when the VertexAISearchTool is wrapped into an AgentTool,

Metadata

Metadata

Assignees

Labels

tools[Component] This issue is related to tools

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions