Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 11, 2025

Motivation and Context

DelegatingAIAgent implements the decorator pattern as a base class for composable agent pipelines. It was designed to be inherited, not instantiated directly - it has a protected constructor and only provides pass-through behavior. Making it abstract enforces this design intent.

Contributes to: #2542

Description

Changed the class declaration from public class to public abstract class:

public abstract class DelegatingAIAgent : AIAgent
{
    protected DelegatingAIAgent(AIAgent innerAgent)
    {
        this.InnerAgent = Throw.IfNull(innerAgent);
    }
    // ...
}

This prevents direct instantiation while maintaining full compatibility with all inheriting classes: AnonymousDelegatingAIAgent, LoggingAgent, OpenTelemetryAgent, EntityAgentWrapper, and various sample implementations.

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

Make DelegatingAIAgent abstract


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Dec 11, 2025
Co-authored-by: SergeyMenshykh <[email protected]>
Copilot AI changed the title [WIP] Make DelegatingAIAgent class abstract Make DelegatingAIAgent abstract Dec 11, 2025
Copilot AI requested a review from SergeyMenshykh December 11, 2025 20:04
@github-actions github-actions bot changed the title Make DelegatingAIAgent abstract .NET: Make DelegatingAIAgent abstract Dec 11, 2025
@SergeyMenshykh SergeyMenshykh marked this pull request as ready for review December 12, 2025 09:38
Copilot AI review requested due to automatic review settings December 12, 2025 09:38
@SergeyMenshykh SergeyMenshykh changed the title .NET: Make DelegatingAIAgent abstract .NET: [Breaking] Make DelegatingAIAgent abstract Dec 12, 2025
@SergeyMenshykh SergeyMenshykh changed the title .NET: [Breaking] Make DelegatingAIAgent abstract .NET: Make DelegatingAIAgent abstract Dec 12, 2025
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 makes the DelegatingAIAgent class abstract to enforce its intended design as a base class for the decorator pattern. The class was always designed to be inherited (protected constructor, pass-through behavior), and making it abstract prevents direct instantiation while maintaining full compatibility with all existing inheritors.

  • Changed class declaration from public class to public abstract class

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