Skip to content

.NET: Introduce Core implementation methods for session methods on AIAgent#3699

Open
westey-m wants to merge 5 commits intomicrosoft:mainfrom
westey-m:aiagent-core-session-methods
Open

.NET: Introduce Core implementation methods for session methods on AIAgent#3699
westey-m wants to merge 5 commits intomicrosoft:mainfrom
westey-m:aiagent-core-session-methods

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
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.

4 participants