.NET: Support reasoning events in AGUI#4953
Open
jeffinsibycoremont wants to merge 1 commit intomicrosoft:mainfrom
Open
.NET: Support reasoning events in AGUI#4953jeffinsibycoremont wants to merge 1 commit intomicrosoft:mainfrom
jeffinsibycoremont wants to merge 1 commit intomicrosoft:mainfrom
Conversation
232e036 to
8056b71
Compare
Author
@microsoft-github-policy-service agree company="Coremont" |
8056b71 to
8aff11b
Compare
8aff11b to
40dc779
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Relates to the .NET support for reasoning mentioned in #2619 and parent issue #2558.
Description
7 new events based on agui spec https://docs.ag-ui.com/concepts/reasoning (note 'thinking' is depreciated and the convention now is 'reasoning' https://docs.ag-ui.com/concepts/reasoning#deprecated-events)
Outbound path (AsAGUIEventStreamAsync)
TextReasoningContent from the IChatClient pipeline is now converted into the explicit AG-UI reasoning lifecycle
(REASONING_START → REASONING_MESSAGE_START → REASONING_MESSAGE_CONTENT → REASONING_MESSAGE_END → REASONING_END).
ProtectedData is emitted as REASONING_ENCRYPTED_VALUE inline after the content delta. Content with only ProtectedData (no visible text) is not dropped - the block is opened and the encrypted value emitted without a content delta.
Inbound path (AsChatResponseUpdatesAsync)
A new ReasoningMessageBuilder (following the TextMessageBuilder pattern) handles both the explicit lifecycle form and the chunk shorthand form (REASONING_MESSAGE_CHUNK).
ReasoningStartEvent/ReasoningEndEvent are consumed as no-op bracket markers. The builder enforces the same invariants as TextMessageBuilder - overlapping starts and mismatched ends throw InvalidOperationException.
Contribution Checklist