-
Notifications
You must be signed in to change notification settings - Fork 1.1k
.NET: [BREAKING] Introduce Core implementation methods for session methods on AIAgent #3699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.NET: [BREAKING] Introduce Core implementation methods for session methods on AIAgent #3699
Conversation
There was a problem hiding this 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 |
|
@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 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. |
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