Description
When using Gemini 3 models (gemini-3-flash-preview, gemini-3-pro-preview) as the provider for a Windmill AI Agent step (type: ai_agent), function calling fails with a 400 error from the Google AI API:
API error: HTTP status client error (400 Bad Request) for url
(https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:streamGenerateContent?alt=sse)
{
"error": {
"code": 400,
"message": "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:get_purchase_taxes', position 3.
Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.",
"status": "INVALID_ARGUMENT"
}
}
The error occurs at ai_executor.rs:740:32.
Root Cause
Gemini 3 models require thought signatures for function calling. When the model responds with a functionCall part, it includes a thoughtSignature field. This signature must be echoed back in subsequent requests as part of the conversation history. Without it, the API returns a 400 error.
This is mandatory even when thinking is set to minimal. See: https://ai.google.dev/gemini-api/docs/thought-signatures
What needs to change
The AI agent executor (ai_executor.rs) needs to:
- Parse
thoughtSignature fields from Gemini's functionCall response parts
- Include them when sending function results back to the API
- Preserve the order of parts (for parallel function calls, only the first part contains the signature)
The official Google SDKs (Python, Node, Java) handle this automatically when using chat history objects.
Reproduction
- Create a flow with an
ai_agent step
- Configure provider:
kind: googleai, model: gemini-3-flash-preview
- Add any script tool
- Run the flow — the AI agent will attempt a tool call and fail with the above error
Environment
- Windmill version: v1.612.2 (EE)
- Provider: Google AI (Gemini)
- Models affected:
gemini-3-flash-preview, gemini-3-pro-preview
- Models NOT affected:
gemini-2.0-flash (no thought signatures required)
References
Description
When using Gemini 3 models (
gemini-3-flash-preview,gemini-3-pro-preview) as the provider for a Windmill AI Agent step (type: ai_agent), function calling fails with a 400 error from the Google AI API:The error occurs at
ai_executor.rs:740:32.Root Cause
Gemini 3 models require thought signatures for function calling. When the model responds with a
functionCallpart, it includes athoughtSignaturefield. This signature must be echoed back in subsequent requests as part of the conversation history. Without it, the API returns a 400 error.This is mandatory even when thinking is set to minimal. See: https://ai.google.dev/gemini-api/docs/thought-signatures
What needs to change
The AI agent executor (
ai_executor.rs) needs to:thoughtSignaturefields from Gemini'sfunctionCallresponse partsThe official Google SDKs (Python, Node, Java) handle this automatically when using chat history objects.
Reproduction
ai_agentstepkind: googleai,model: gemini-3-flash-previewEnvironment
gemini-3-flash-preview,gemini-3-pro-previewgemini-2.0-flash(no thought signatures required)References