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

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

未關閉
#2,421 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement
主要語言
Python
星號
15.9k
分支
1.4k
平均合併
1 天 17 小時
30 天內合併 PR
163

描述

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

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。