ag-ui-protocol / ag-ui-protocol/ag-ui

[Feature]: Add opt-in support for reasoning messages in Claude adapter snapshots

Offen
#2,421 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
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 and this hasn't been requested yet.

### Problem or Motivation

The Claude Agent SDK integration emits reasoning events during streaming, but the final `MESSAGES_SNAPSHOT` does not retain those reasoning messages. As a result, the client transcript after a run can differ from what was visible during streaming, making reasoning unavailable for UI history and replay.

Some applications need to retain reasoning, while others should avoid persisting it for privacy, retention, payload-size, or provider-specific data reasons.

### Proposed Solution

Add an adapter configuration option to opt in to reasoning messages in `MESSAGES_SNAPSHOT`.

Expected behavior:

• Disabled by default for backward compatibility.
• When enabled, include ordered  role: `reasoning` messages in snapshots.
• Preserve encrypted reasoning values when available.
• Avoid duplicating reasoning messages already present in a snapshot.
• Keep replay-only reasoning out of provider input.
• Emit the final snapshot before `RUN_FINISHED` or  `RUN_ERROR`.

### Alternatives Considered

1. Always include reasoning in snapshots. This could unexpectedly increase persisted data and expose content that applications do not want to retain.
2. Continue exposing reasoning only through live events. This does not support reliable history or replay.
3. Let each application implement custom snapshot enrichment. This duplicates adapter logic and can produce inconsistent behavior.

### Additional Context

The protocol already supports messages with  role: `reasoning`. The requested change concerns the Claude Agent SDK integration and should preserve its current default behavior while allowing applications to explicitly choose durable reasoning history.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

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