.NET: Introduce Core implementation methods for session methods on AIAgent#3699
Open
westey-m wants to merge 5 commits intomicrosoft:mainfrom
Open
.NET: Introduce Core implementation methods for session methods on AIAgent#3699westey-m wants to merge 5 commits intomicrosoft:mainfrom
westey-m wants to merge 5 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a consistent pattern for session management methods in the AIAgent base class by adding "Core" implementation methods. The changes extend an existing architectural pattern where public methods delegate to protected abstract Core methods, allowing AIAgent to perform common work before delegating to specific implementations.
Changes:
- Added public wrapper methods (CreateSessionAsync, SerializeSession, DeserializeSessionAsync) and corresponding protected abstract Core methods in AIAgent base class
- Updated all agent implementations to override the new protected Core methods instead of public abstract methods
- Updated test mocks to properly mock the protected Core methods
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.Abstractions/AIAgent.cs | Added public wrapper methods and protected abstract Core methods for session management |
| dotnet/src/Microsoft.Agents.AI.Abstractions/DelegatingAIAgent.cs | Updated to override Core methods and delegate to inner agent |
| dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs | Changed session methods from public override to protected override Core methods |
| dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowHostAgent.cs | Changed session methods from public override to protected override Core methods |
| dotnet/src/Microsoft.Agents.AI.Purview/PurviewAgent.cs | Changed session methods from public override to protected override Core methods |
| dotnet/src/Microsoft.Agents.AI.GitHub.Copilot/GitHubCopilotAgent.cs | Changed session methods from public override to protected override Core methods |
| dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgentProxy.cs | Changed session methods from public override to protected override Core methods |
| dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgent.cs | Changed session methods from public override to protected override Core methods |
| dotnet/src/Microsoft.Agents.AI.CopilotStudio/CopilotStudioAgent.cs | Changed session methods from public override to protected override Core methods |
| dotnet/src/Microsoft.Agents.AI.A2A/A2AAgent.cs | Changed session methods from public override to protected override Core methods |
| dotnet/samples/GettingStarted/AgentProviders/Agent_With_CustomImplementation/Program.cs | Updated sample code to override Core methods |
| dotnet/tests/* (multiple test files) | Updated all test agent implementations to override Core methods and fixed mock setups |
SergeyMenshykh
approved these changes
Feb 5, 2026
rogerbarreto
approved these changes
Feb 6, 2026
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
For all run methods on AIAgent we currently have public and protected abstract Core methods for doing the main implementation.
This allows us to do some common work in AIAgent that should apply to all agents.
Extending this pattern to the session methods as well.
Description
Contribution Checklist