Description
Package (Required)
- langchain-google-genai
- langchain-google-vertexai
- langchain-google-community
- Other / not sure / general
Checked other resources
- I added a descriptive title to this issue
- I searched the LangChain documentation and API reference (linked above)
- I used the GitHub search to find a similar issue and didn't find it
- I am sure this is a bug and not a question or request for help
Example Code (Python)
import os
from typing import TypedDict, Annotated
import operator
from langchain_core.messages import BaseMessage
from langchain_core.agents import AgentAction, AgentFinish
from langchain_core.tools import tool
from langchain_google_genai import ChatGoogleGenerativeAI
from langgraph.prebuilt import create_react_agent
# --- 1. Set up your environment ---
# os.environ["GOOGLE_API_KEY"] = "YOUR_GOOGLE_API_KEY"
# --- 2. Define a simple tool ---
@tool
def get_weather(city: str) -> str:
"""Gets the weather for a specific city."""
if "san francisco" in city.lower():
return "The weather in San Francisco is foggy."
return f"The weather in {city} is sunny."
tools = [get_weather]
# --- 3. Initialize the model ---
# Using a Gemini 3 model and enabling the "thinking" feature
model = ChatGoogleGenerativeAI(
model="gemini-3-pro-preview",
include_thoughts=True
)
# --- 4. Create the agent ---
agent_executor = create_react_agent(model, tools)
# --- 5. Invoke the agent ---
prompt = "what is the weather in san francisco?"
print(f"Invoking agent with prompt: '{prompt}'")
try:
response = agent_executor.invoke({"messages": [("user", prompt)]})
print("--- Agent Response ---")
print(response)
except Exception as e:
print("\n--- An Error Occurred ---")
print(f"Error: {e}")Error Message and Stack Trace (if applicable)
Error in langgraph_multi_agent: Invalid argument provided to Gemini: 400 Function call is missing a thought_signature in functionCall parts. This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance. Additional data, function call `default_api:smart_plan` , position 6. please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.Description
When using ChatGoogleGenerativeAI with a Gemini 3 model (e.g., gemini/gemini-3-pro) and create_react_agent from langgraph.prebuilt, Im encountering an InvalidArgument: 400 Function call is missing a thought_signature error when the agent attempts to make a tool call.
Steps to Reproduce
- Run the example code below with a Gemini 3 model.
- The agent should attempt to call the get_weather tool.
- The code will raise an InvalidArgument: 400 Function call is missing
a thought_signature error.
Expected Behavior
The agent should be able to call the tool without a thought_signature error, as include_thoughts=True is expected to handle this automatically.
Actual Behavior
The following error is raised:
1 langchain_google_genai.chat_models.ChatGoogleGenerativeAIErr
or: Invalid argument provided to Gemini: 400 Function call
is missing a thought_signature in functionCall parts. This
is required for tools to work correctly, and missing
thought_signature may lead to degraded model performance.
Environment
- langchain-core: [Please fill in your version, e.g., 1.0.5]
- langchain-google-genai: [Please fill in your version, e.g., 3.0.3]
- langgraph: [Please fill in your version, e.g., 0.6.6]
- Python: [Please fill in your version, e.g., 3.12]
Activity
lkuligin commentedon Nov 18, 2025
what version of
langchain-google-genailibrary are you using? could you please double-check that you've installed the last one (your snippet is running without any errors on my end)mdrxy commentedon Nov 18, 2025
Deni Andreawan (@deniandreawan) you need
langchain-google-genai 3.1.0or greater. Let me know if this persists after upgrading and can re-open if so.CRITICAL FIX: Switch to gemini-2.0-flash-exp to resolve tool calling bug
david-dahan commentedon Nov 23, 2025
is there any forecast to when a solution will be patched into the vertex API ?
mdrxy commentedon Nov 23, 2025
david-dahan this week
feat(google): preserve thought signatures for Gemini 3+ function calling
fix: add fixThoughtSignatures to Google AI endpoint for Gemini 3+ too…