Repository navigation
Description
** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.
Describe the bug
Unable to call tools when using litellm to access gemini 3 [model=LiteLlm(model="vertex_ai/gemini-3-pro-preview") ]
Works when you query the llm without tools calls. Fails when it calls a tool .
Confirmed this works as expected with other gemini models [model=LiteLlm(model="vertex_ai/gemini-2.5-flash") ]
To Reproduce
Please share a minimal code and data to reproduce your problem.
Add gemini 3 to litellm , have it call a tool.
`
from google.adk.agents.llm_agent import Agent
from google.adk.tools import FunctionTool
from google.adk.models.lite_llm import LiteLlm
def get_weather_report(city: str) -> dict:
"""Retrieves the current weather report for a specified city.
Returns:
dict: A dictionary containing the weather information with a 'status' key ('success' or 'error') and a 'report' key with the weather details if successful, or an 'error_message' if an error occurred.
"""
if city.lower() == "london":
return {"status": "success", "report": "The current weather in London is cloudy with a temperature of 18 degrees Celsius and a chance of rain."}
elif city.lower() == "paris":
return {"status": "success", "report": "The weather in Paris is sunny with a temperature of 25 degrees Celsius."}
else:
return {"status": "error", "error_message": f"Weather information for '{city}' is not available."}
weather_tool = FunctionTool(func=get_weather_report)
root_agent = Agent(
model=LiteLlm(model="vertex_ai/gemini-3-pro-preview"),
name='root_agent',
description='A helpful assistant for user questions.',
instruction='Answer user questions to the best of your knowledge',
tools=[weather_tool],
)
`
Snippet of Output:
...<11 lines>...
)
litellm.exceptions.BadRequestError: litellm.BadRequestError: Vertex_aiException BadRequestError - {
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
Expected behavior
This should not fail calling tools
Desktop (please complete the following information):
- OS: [e.g. macOS, Linux, Windows] mac
- Python version(python -V): 3.13
- ADK version(pip show google-adk): 1.19
Model Information:
- Are you using LiteLLM: Yes
- Which model is being used(e.g. gemini-3-pro-preview)
Activity
DeanChensj commentedon Nov 20, 2025
Hi @lambda72453 , could you try use Gemini model directly, for vertex you should use the
globalendpointsurajksharma07 commentedon Nov 20, 2025
@lambda72453 This appears to be a compatibility issue between Gemini 3's tool calling API and LiteLLM's current implementation.
As a workaround, you can use
LiteLlm(model="vertex_ai/gemini-2.5-flash")which you've confirmed works, or alternatively try using ADK's native Gemini integration withGemini(model="gemini-3-pro-preview")instead of going through LiteLLM.We're investigating more into it like whether this requires changes in ADK's LiteLLM adapter or if it's a limitation in LiteLLM's Gemini 3 support.
Thanks!
xuguozhi commentedon Nov 20, 2025
A more detailed info might help:
litellm.llms.openai.common_utils.OpenAIError: Error code: 400 - {'error': {'message': 'Unable to submit request because function calldefault_apiin the 2. content block is missing athought_signature. Learn more: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thought-signatures', 'type': '', 'param': '', 'code': 400}}@surajksharma07surajksharma07 commentedon Nov 20, 2025
Thanks @xuguozhi for the detailed error.That clarifies the root cause - Gemini 3 requires
thought_signaturefor function calling, which LiteLLM currently doesn't handle.This is a Gemini 3-specific requirement that's automatically managed by Google's native SDKs.
The best solution is to use ADK's native Gemini integration:
Gemini(model="gemini-3-pro-preview")instead ofLiteLlm(model="vertex_ai/gemini-3-pro-preview").This will handle thought signatures automatically and resolve the issue.
xuguozhi commentedon Nov 20, 2025
Thanks @surajksharma07 Gemini(model="gemini-3-pro-preview" could help in no-streaming way. However, in streaming mode it will stop with none following response
surajksharma07 commentedon Nov 20, 2025
Thanks for testing @xuguozhi Could you provide more details about the streaming issue?
Specifically: (1) how are you enabling streaming mode (code snippet would help),
(2) does it throw an error or just stop producing output, and
(3) does this happen with all queries or only when function calling is involved?
This sounds like a separate issue with Gemini 3's streaming implementation in ADK that we should investigate.
lambda72453 commentedon Nov 21, 2025
@surajksharma07 thanks , i've been using that solution in the mean time .
fix: disable grounding tools for Gemini 3 models
surajksharma07 commentedon Feb 4, 2026
Checked against latest ADK (post v1.23.0) — this issue persists.
The root cause is that Gemini 3 requires
thought_signaturefor function calling, which LiteLLM doesn't handle.ADK's native Gemini integration supports thought signatures (
streaming_utils.py:51,166-168,interactions_utils.py:153-156) but the LiteLLM adapter inlite_llm.pyhas no such handling.Commit
6a1efee("disable grounding tools for Gemini 3") addresses a different issue.Workaround: use
Gemini(model="gemini-3-pro-preview")instead ofLiteLlm(model="vertex_ai/gemini-3-pro-preview").this is fundamentally a LiteLLM dependency limitation.
surajksharma07 commentedon May 5, 2026
@lambda72453 The thought_signature handling for LiteLLM + Gemini 3 tool calls was fixed in ADK v1.27.0 (commit ae565be), so LiteLlm(model="vertex_ai/gemini-3-pro-preview") with tools should work correctly on v1.27.0 and later.
Since it's been a while and the fix has been in for a few releases now (latest is v1.32.0),
feel free to reopen if you're still hitting the issue after upgrading!