Skip to content

.NET: Support reasoning events in AGUI#4953

Open
jeffinsibycoremont wants to merge 1 commit intomicrosoft:mainfrom
jeffinsibycoremont:feature/support-reasoning
Open

.NET: Support reasoning events in AGUI#4953
jeffinsibycoremont wants to merge 1 commit intomicrosoft:mainfrom
jeffinsibycoremont:feature/support-reasoning

Conversation

@jeffinsibycoremont
Copy link
Copy Markdown

@jeffinsibycoremont jeffinsibycoremont commented Mar 27, 2026

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)

  • ReasoningStartEvent
  • ReasoningMessageStartEvent
  • ReasoningMessageContentEvent
  • ReasoningMessageEndEvent
  • ReasoningEndEvent
  • ReasoningMessageChunkEvent
  • ReasoningEncryptedValueEvent

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

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@github-actions github-actions bot changed the title Support reasoning .NET: Support reasoning Mar 27, 2026
@jeffinsibycoremont jeffinsibycoremont marked this pull request as draft March 27, 2026 17:35
@jeffinsibycoremont jeffinsibycoremont force-pushed the feature/support-reasoning branch 2 times, most recently from 232e036 to 8056b71 Compare March 27, 2026 18:11
@jeffinsibycoremont
Copy link
Copy Markdown
Author

@jeffinsibycoremont please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree company="Coremont"

@jeffinsibycoremont jeffinsibycoremont force-pushed the feature/support-reasoning branch from 8056b71 to 8aff11b Compare March 27, 2026 18:30
@jeffinsibycoremont jeffinsibycoremont marked this pull request as ready for review March 27, 2026 18:31
@jeffinsibycoremont jeffinsibycoremont changed the title .NET: Support reasoning .NET: Support reasoning events in AGUI Mar 27, 2026
@jeffinsibycoremont jeffinsibycoremont force-pushed the feature/support-reasoning branch from 8aff11b to 40dc779 Compare March 27, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants