Skip to content

InvalidArgument: 400 Function call is missing a thought_signature with Gemini 3 and create_react_agent #1364

Closed

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

  1. Run the example code below with a Gemini 3 model.
  2. The agent should attempt to call the get_weather tool.
  3. 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

  1. lkuligin commented on Nov 18, 2025

    @lkuligin
    Collaborator

    what version of langchain-google-genai library 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)

  2. mdrxy commented on Nov 18, 2025

    @mdrxy
    Member

    Deni Andreawan (@deniandreawan) you need langchain-google-genai 3.1.0 or greater. Let me know if this persists after upgrading and can re-open if so.

  3. david-dahan commented on Nov 23, 2025

    @david-dahan

    is there any forecast to when a solution will be patched into the vertex API ?

  4. mdrxy commented on Nov 23, 2025

    @mdrxy
    Member

    david-dahan this week

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggenai`langchain-google-genai` package

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions