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)

Offen
#1,245 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Python
Sterne
15.9k
Forks
1.4k
Ø Merge
1 T. 17 Std.
Gemergte PRs (30 T.)
163

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.