Skip to content

Conversation

@westey-m
Copy link
Contributor

@westey-m westey-m commented Jan 2, 2026

Motivation and Context

The ChatClientAgent factory context classes do not ever make sense to derive from, since they are only created by the ChatClientAgent.

Description

  • Seal the ChatClientAgent factory context classes
  • Add overloads for structured output deserialization that doesn't require a JSO param.

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.

Copilot AI review requested due to automatic review settings January 2, 2026 16:09
@westey-m westey-m mentioned this pull request Jan 2, 2026
54 tasks
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the ChatClientAgent API by sealing factory context classes to prevent unintended inheritance and adding convenience overloads for structured output deserialization that use default JSON serializer options.

  • Sealed AIContextProviderFactoryContext and ChatMessageStoreFactoryContext classes to prevent inheritance
  • Added parameterless Deserialize<T>() and TryDeserialize<T>() overloads that use default JSON serializer options
  • Updated tests to verify both the new parameterless overloads and existing JSO-based overloads with conditional compilation for .NET Framework

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgentOptions.cs Sealed the factory context classes to prevent inheritance
dotnet/src/Microsoft.Agents.AI.Abstractions/AgentRunResponse.cs Added parameterless overloads for Deserialize<T>() and TryDeserialize<T>() that use default JSON serializer options
dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgentRunResponse{T}.cs Removed outdated documentation reference to TryDeserialize{T}
dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentRunResponseTests.cs Added tests for new parameterless deserialization overloads with conditional compilation directives for .NET Framework

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@moonbox3 moonbox3 added the .NET label Jan 7, 2026
@github-actions github-actions bot changed the title Seal factory contexts and add non JSO deserialize overloads .NET: Seal factory contexts and add non JSO deserialize overloads Jan 7, 2026
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.

4 participants