Skip to content

Conversation

@westey-m
Copy link
Contributor

@westey-m westey-m commented Feb 5, 2026

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

  • Add Core methods for CreateSession, SerializeSession and DeserializeSession

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 February 5, 2026 14:50
@markwallace-microsoft markwallace-microsoft added .NET workflows Related to Workflows in agent-framework labels Feb 5, 2026
@github-actions github-actions bot changed the title Introduce Core implementation methods for session methods on AIAgent .NET: Introduce Core implementation methods for session methods on AIAgent Feb 5, 2026
@westey-m westey-m mentioned this pull request Feb 5, 2026
61 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 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

@markwallace-microsoft markwallace-microsoft added the documentation Improvements or additions to documentation label Feb 5, 2026
@westey-m westey-m enabled auto-merge February 6, 2026 11:35
@westey-m westey-m added this pull request to the merge queue Feb 6, 2026
Merged via the queue into microsoft:main with commit ac17adb Feb 6, 2026
15 of 17 checks passed
@rwjdk
Copy link

rwjdk commented Feb 10, 2026

@westey-m : This is actually a breaking change (but not marked as such in the release notes) for those of us who make our own inherited agents.

@westey-m westey-m changed the title .NET: Introduce Core implementation methods for session methods on AIAgent .NET: [BREAKING] Introduce Core implementation methods for session methods on AIAgent Feb 10, 2026
@westey-m
Copy link
Contributor Author

@westey-m : This is actually a breaking change (but not marked as such in the release notes) for those of us who make our own inherited agents.

Thanks @rwjdk, you are absolutely right. I've updated the title to reflect this.

@rwjdk
Copy link

rwjdk commented Feb 10, 2026

@westey-m Might also want to update it here: https://github.com/microsoft/agent-framework/releases/tag/dotnet-1.0.0-preview.260209.1 (does not auto-reflect PR name change after the fact)

@westey-m
Copy link
Contributor Author

@westey-m Might also want to update it here: https://github.com/microsoft/agent-framework/releases/tag/dotnet-1.0.0-preview.260209.1 (does not auto-reflect PR name change after the fact)

Thanks, updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation .NET workflows Related to Workflows in agent-framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants