Skip to content

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

Closed

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,

Activity

  1. added theissue type on Sep 26, 2025
  2. boyangsvl commented on Oct 8, 2025

    @boyangsvl
    Collaborator

    This will be fixed in the upcoming release.

  3. Jacksunwei commented on Oct 27, 2025

    @Jacksunwei
    Collaborator

    This issue has been fixed in v1.17.0 (released October 22, 2025).

    What was fixed: The VertexAiSearchTool now includes a bypass_multi_tools_limit parameter (defaults to False), which allows it to work natively with output_schema and 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:

    pip install --upgrade google-adk

    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.

  4. prashu318 commented on Nov 3, 2025

    @prashu318

    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.

  5. prashu318 commented on Nov 3, 2025

    @prashu318

    We used ADK version 1.17, discovery engine version 0.15 and Google-genai v1.47.0

    @Jacksunwei

  6. desibandhu commented on Nov 11, 2025

    @desibandhu

    Facing the same issue as reported by @prashu318 .

    platformAgent = LlmAgent(
        model='gemini-2.5-flash',
        name='platform_specialist',
        description='Expert in mobile SDKs for Android, iOS, Flutter, React Native, and Cordova.',
        tools=[vertex_search_tool],
    )
    
    root_agent = LlmAgent(
        name=AGENT_NAME_VSEARCH,
        model=GEMINI_2_FLASH, # Requires Gemini model
        sub_agents=[platformAgent],
        instruction=f"""You are a helpful assistant that answers questions based on information found in the document store: {DATASTORE_PATH}.
    )
    

    @Jacksunwei request you to please reopen this issue and investigate.
    I am on google-adk - 1.18.0

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

Metadata

Metadata

Assignees

Labels

tools[Component] This issue is related to tools

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions