Skip to content

Conversation

westey-m
Copy link
Contributor

Motivation and Context

microsoft/agent-framework#1122

Description

Add adapters to allow SK agents to be exposed as AIAgent

Contribution Checklist

@westey-m westey-m requested a review from a team as a code owner October 10, 2025 11:05
@westey-m westey-m requested a review from Copilot October 10, 2025 11:05
Copy link
Contributor

@Copilot 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 adds adapters to allow Semantic Kernel (SK) agents to be exposed as AIAgent implementations from the Microsoft Agent Framework. The implementation provides a common interface conformance pattern that enables different agent types to work through the same AIAgent abstraction.

  • Introduces AIAgentAdapter and AIAgentThreadAdapter classes to bridge SK agents with the Microsoft Agent Framework
  • Adds extension methods for each agent type (OpenAI, Azure AI, Bedrock, etc.) to convert to AIAgent
  • Creates comprehensive unit and integration tests to verify the adapter functionality

Reviewed Changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated no comments.

Show a summary per file
File Description
dotnet/src/Agents/Abstractions/AIAgent/AIAgentAdapter.cs Core adapter class that wraps SK agents and exposes them as AIAgent
dotnet/src/Agents/Abstractions/AIAgent/AIAgentThreadAdapter.cs Thread adapter for bridging SK agent threads with AIAgent threads
dotnet/src/Agents/Abstractions/AgentExtensions.cs Base extension method for converting any SK agent to AIAgent
dotnet/src/Agents/*/Extensions.cs Agent-specific extension methods for each agent type
Unit test files Comprehensive test coverage for all adapter functionality
Integration test files End-to-end testing of adapter conformance

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

/// <summary>
/// Gets the underlying Semantic Kernel Agent Framework <see cref="Agent"/>.
/// </summary>
public Agent InnerAgent { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not fully sure if we need to expose the Agent, we could just recommend the GetService<Agent>() for this.

Suggested change
public Agent InnerAgent { get; }

Comment on lines +24 to +27
/// <summary>
/// Gets the underlying Semantic Kernel Agent Framework <see cref="AgentThread"/>.
/// </summary>
public AgentThread InnerThread { get; }
Copy link
Member

@rogerbarreto rogerbarreto Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rationale here is a bit similar to where after the conversion we don't expose the converted type back as we assume the caller will have the reference already.

private readonly IChatCompletionService _chatCompletionService;

Point to the GetService usage.

Suggested change
/// <summary>
/// Gets the underlying Semantic Kernel Agent Framework <see cref="AgentThread"/>.
/// </summary>
public AgentThread InnerThread { get; }

Copy link
Member

@rogerbarreto rogerbarreto Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit. (Internal)

For the name of this class I would do something in the same lines we did for the ChatCompletionService vs ChatClient.

i.e: SKAgentAIAgent, see ChatCompletionServiceChatClient.cs

<RootNamespace>Microsoft.SemanticKernel.Agents</RootNamespace>
<TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks>
<NoWarn>$(NoWarn)</NoWarn>
<NoWarn>$(NoWarn);NU5104</NoWarn>
Copy link
Member

@rogerbarreto rogerbarreto Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a strong breaking change for .Net Framework based customers as pipelines relying on GA releases will break to update a preview package.

We might need to rethink how bring this dependency...

Suggested change
<NoWarn>$(NoWarn);NU5104</NoWarn>
<NoWarn>$(NoWarn);</NoWarn>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error only surfaces on the package directly referencing the preview package. Anyone who references M.SK.Agents.Abstractions will not have this error for transitive references.
If this was not the case, I would have had to suppress this error for the core agents package as well, since it is also GA, and is referencing MAAI.A as a transitive reference.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants