When using Gemini 3 flash preview and when it does...
# agents
q
When using Gemini 3 flash preview and when it does tool calls with arguments, I keep getting this error, despite having thinking budget enabled. Anyone else facing this?
Copy code
raise ClientError(status_code, response_json, response)                                                                                                                                                                                                                                          
                                           google.genai.errors.ClientError: 400 Bad Request. {'message': '{\n  "error": {\n    "code": 400,\n    "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:find_patient_by_name_dob` , position 13. Please refer to <https://ai.google.dev/gemini-api/docs/thought-signatures> for more details.",\n    "status": "INVALID_ARGUMENT"\n  }\n}\n', 'status': 'Bad Request'}
December 17, 2025 (TODAY!) - There was a commit that adds:"Gemini 3 support with thinking_level and thought_signature" (#4027)
Your Version vs Latest VersionStatus*You have*: 1.3.6❌ Missing Gemini 3 thought signature fix*Latest*: 1.3.8✅ Has the fix (released today!) Solution: Upgrade LiveKit Plugin
Copy code
pip install --upgrade livekit-plugins-google
Or update your requirements:
Copy code
livekit-plugins-google>=1.3.8
The thought signature support was literally added today.
This didn't seem to fix the issue too
Copy code
14:48:38.943 ERROR  livekit.agents     Error in _llm_inference_task                                                                                                                                                                                  
                                           Traceback (most recent call last):                                                                                                                                                                            
                                             File "/Users/krishnachoudhary/Documents/errands-ecw-new-endpoints-identity/agents/.venv/lib/python3.11/site-packages/livekit/plugins/google/llm.py", line 427, in _run                                      
                                               raise APIStatusError(                                                                                                                                                                                     
                                           livekit.agents._exceptions.APIStatusError: no response generated (status_code=-1, request_id=41325ae23a79, body=None, retryable=False)                                                                        
                                                                                                                                                                                                                                                         
                                           The above exception was the direct cause of the following exception:                                                                                                                                          
                                                                                                                                                                                                                                                         
                                           Traceback (most recent call last):                                                                                                                                                                            
                                             File "/Users/krishnachoudhary/Documents/errands-ecw-new-endpoints-identity/agents/.venv/lib/python3.11/site-packages/livekit/agents/utils/log.py", line 16, in async_fn_logs                                
                                               return await fn(*args, **kwargs)                                                                                                                                                                          
                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                          
                                             File "/Users/krishnachoudhary/Documents/errands-ecw-new-endpoints-identity/agents/.venv/lib/python3.11/site-packages/opentelemetry/util/_decorator.py", line 71, in async_wrapper                           
                                               return await func(*args, **kwargs)  # type: ignore                                                                                                                                                        
                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                        
                                             File "/Users/krishnachoudhary/Documents/errands-ecw-new-endpoints-identity/agents/.venv/lib/python3.11/site-packages/livekit/agents/voice/generation.py", line 130, in _llm_inference_task                  
                                               async for chunk in llm_node:                                                                                                                                                                              
                                             File "/Users/krishnachoudhary/Documents/errands-ecw-new-endpoints-identity/agents/src/agents/base.py", line 169, in llm_node                                                                                
                                               async for chunk in Agent.default.llm_node(                                                                                                                                                                
                                             File "/Users/krishnachoudhary/Documents/errands-ecw-new-endpoints-identity/agents/.venv/lib/python3.11/site-packages/livekit/agents/voice/agent.py", line 417, in llm_node                                  
                                               async for chunk in stream:                                                                                                                                                                                
                                             File "/Users/krishnachoudhary/Documents/errands-ecw-new-endpoints-identity/agents/.venv/lib/python3.11/site-packages/livekit/agents/llm/llm.py", line 350, in __anext__                                     
                                               raise exc  # noqa: B904                                                                                                                                                                                   
                                               ^^^^^^^^^                                                                                                                                                                                                 
                                             File "/Users/krishnachoudhary/Documents/errands-ecw-new-endpoints-identity/agents/.venv/lib/python3.11/site-packages/livekit/agents/llm/llm.py", line 177, in _traceable_main_task                          
                                               await self._main_task()                                                                                                                                                                                   
                                             File "/Users/krishnachoudhary/Documents/errands-ecw-new-endpoints-identity/agents/.venv/lib/python3.11/site-packages/livekit/agents/llm/llm.py", line 196, in _main_task                                    
                                               return await self._run()                                                                                                                                                                                  
                                                      ^^^^^^^^^^^^^^^^^                                                                                                                                                                                  
                                             File "/Users/krishnachoudhary/Documents/errands-ecw-new-endpoints-identity/agents/.venv/lib/python3.11/site-packages/livekit/plugins/google/llm.py", line 472, in _run                                      
                                               raise APIConnectionError(                                                                                                                                                                                 
                                           livekit.agents._exceptions.APIConnectionError: gemini llm: error generating content no response generated (status_code=-1, request_id=41325ae23a79, body=None, retryable=False) (body=None, retryable=False)  
                                         {"pid": 82091, "job_id": "AJ_t4FimzNCCAC6", "room_id": "RM_i4qQp5ipzaPf"}
Traceback (most recent call last):
The Problem Gemini 3 has a feature called "thinking" - it internally reasons before responding. When it makes a function/tool call, it includes an encrypted blob called a
thought_signature
that represents its internal thought process. The rule: On subsequent turns, you must send back the
thought_signature
with the function call history, or Gemini 3 rejects the request with a 400 error.Visual Flow
Copy code
┌─────────────────────────────────────────────────────────────────┐
│  TURN 1: User says "Book appointment for tomorrow"              │
└─────────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│  Gemini 3 Response:                                             │
│  - function_call: check_availability                            │
│  - call_id: "abc123"                                            │
│  - thought_signature: <encrypted blob>  ◄── WE MUST SAVE THIS   │
└─────────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│  Our code executes check_availability, gets result              │
└─────────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│  TURN 2: Send back to Gemini 3 with history:                    │
│                                                                 │
│  - Original user message                                        │
│  - function_call: check_availability                            │
│    call_id: "abc123"                                            │
│    thought_signature: <encrypted blob>  ◄── MUST INCLUDE THIS   │
│  - function_response: {available: true}                         │
└─────────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│  Gemini 3 validates signature ✓ and continues conversation      │
└─────────────────────────────────────────────────────────────────┘
What LiveKit 1.3.8 Was Missing 1. LiveKit 1.3.8 didn't have this logic:*No capture*: When Gemini 3 responded with a function call + thought_signature, LiveKit ignored the signature 2. No storage: Nowhere to keep signatures between turns 3. No replay: When building the next request, signatures weren't attached to function calls What Our Patches Do Patch 1 - llm.py (capture & store):
Copy code
Response comes in
       │
       ▼
┌──────────────────────────────┐
│ _parse_part() sees:          │
│   function_call.name         │
│   function_call.id = "abc123"│
│   thought_signature = <blob> │
└──────────────────────────────┘
       │
       ▼
┌──────────────────────────────┐
│ Store in dictionary:         │
│ _thought_signatures = {      │
│   "abc123": <blob>           │
│ }                            │
└──────────────────────────────┘
Patch 2 - google.py (replay):
Copy code
Building next request
       │
       ▼
┌──────────────────────────────┐
│ to_chat_ctx() builds history │
│ Sees function_call "abc123"  │
│ Looks up in thought_signatures│
│ Attaches signature to payload│
└──────────────────────────────┘
       │
       ▼
┌──────────────────────────────┐
│ Final payload includes:      │
│ {                            │
│   "function_call": {...},    │
│   "thought_signature": <blob>│
│ }                            │
└──────────────────────────────┘
Why It's Required 1. Google uses thought signatures for:*Security* - Proves the function call came from a real Gemini response, not fabricated 2. Context continuity - Gemini can verify its reasoning chain wasn't tampered with 3. Billing/audit - Links requests together Without it, Gemini 3 says "I don't recognize this function call as mine" and rejects with 400.
l
Sorry, I'm not sure I follow... this is the pull request you're referring to: https://github.com/livekit/agents/pull/4027
What Our Patches Do
Are you the author of the pull request?
atest: 1.3.8✅ Has the fix (released today!)
I don't think is correct, I don't see it listed in https://github.com/livekit/agents/releases/tag/livekit-agents%401.3.8