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)

Abierto
#1,245 4 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Python
Estrellas
15.9k
Forks
1.4k
Merge medio
1 d 17 h
PR fusionados (30 d)
163

Descripción

### 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_

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.