ag-ui-protocol / ag-ui-protocol/ag-ui
[Bug]: Gemini 2.5 or 3 tool calls fail with missing thought_signature in @ag-ui/mastra roundtrip (frontend/client tool flows)
- Lingua principale
- Python
- Stelle
- 15.9k
- Fork
- 1.4k
- Merge medio
- 1g 17h
- PR unite (30g)
- 163
Descrizione
### Pre-flight Checklist
- [x] I have searched [existing issues](https://github.com/ag-ui-protocol/ag-ui/issues) and this hasn't been reported yet.
- [x] I am using the **latest** version AG-UI.
### Describe the Bug
We’re seeing consistent failures with Gemini >= 2.5 models when using @ag-ui/mastra with tool use flows that involve frontend/client tools (CopilotKit useComponent / HITL-style interactions).
The run fails with:
{
"type": "RUN_ERROR",
"message": "AI_APICallError: 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-current-date` , position 9. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.",
"code": "INCOMPLETE_STREAM"
}
This appears to be Gemini >= 2.5 specific, and relates to when frontend tools are used (via copilotkit).
### Steps to Reproduce
Steps to Reproduce
1. Use @ag-ui/mastra as the runtime adapter with Mastra + CopilotKit.
2. Configure a Gemini 3 model (for example gemini-3.1-flash-lite-preview) via @ai-sdk/google.
3. Register at least:
- one frontend only tool (e.g. UI card/HITL).
4. Run a conversation that triggers a round trip - Agent -> client tool call -> agent.
5. Observe stream failure with missing thought_signature / INCOMPLETE_STREAM.
### Expected Behavior
Tool-calling conversation should continue normally with Gemini 2.5/3, with no thought_signature validation error.
thought_signature preserved.
### Environment
```text
- @ag-ui/mastra: 1.0.0
- @ag-ui/core: 0.0.47
- @copilotkit/runtime: 1.52.1
- @mastra/core: 1.9.0
- @ai-sdk/google: 3.0.43
- Node: v22.22.0
- pnpm: 10.29.3
- OS: Linux
```
### Screenshots
_No response_
### Logs & Errors
```shell
{
"type": "RUN_ERROR",
"message": "AI_APICallError: 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-current-date` , position 9. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.",
"code": "INCOMPLETE_STREAM"
}
```
### Additional Context
_No response_
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.