-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Describe the bug When using the gemini-3-flash-preview model with tools enabled and streaming set to True, the LLM response is consistently empty/blank.
This issue does not occur under the following conditions:
Using gemini-2.5-flash (works perfectly).
Setting stream=False with gemini-3-flash-preview.
Using gemini-3-flash-preview without any tools.
Repeated testing with the same prompt confirms that this issue is specific to the combination of the Gemini 3 Flash Preview model + Tools + Streaming.
To Reproduce Steps to reproduce the behavior:
Define an LlmAgent using gemini-3-flash-preview.
Attach a tool (e.g., a simple calculation tool).
Run the agent with a prompt that triggers the tool, ensuring stream=True.
Minimal Reproducible Code:
Python
import asyncio
from google.adk.agents import LlmAgent
async def calculation_tool(input: str) -> str:
try:
result = str(eval(input))
return result
except Exception as e:
return f"Error: {str(e)}"
# Setup the agent with gemini-3-flash-preview
root_agent = LlmAgent(
name="calculation_agent",
description="This agent performs basic arithmetic calculations based on user input.",
instruction="""
Use the provided calculation_tool to perform arithmetic operations.
Only use the calculation_tool for calculations.
Provide the final result directly to the user without additional explanations.
""",
model="gemini-3-flash-preview", # Bug occurs with this version
tools=[
calculation_tool
]
)
Expected behavior The model should invoke the tool, process the result, and stream the text response back to the user, similar to how gemini-2.5-flash behaves under the same configuration.
Screenshots N/A
Desktop (please complete the following information):
OS: window
Python version:3.12
ADK version: 1.21.0
Model Information:
Using Gemini API (Not vertexai)
Which model is being used: gemini-3-flash-preview
Additional context
Isolation Test 1: Changed model to gemini-2.5-flash -> Works.
Isolation Test 2: Kept gemini-3-flash-preview but set stream=False -> Works.
Isolation Test 3: Kept gemini-3-flash-preview and stream=True but removed tools -> Works.
The issue appears to be a specific breakdown in handling the streaming response payload when tool calls are involved in the new Gemini 3 preview model.