Skip to content
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 Agents: Update experimental meta-data for graduation #10600

Open
wants to merge 49 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
43c26ae
Checkpoint
crickman Feb 18, 2025
525b711
Merge branch 'main' into agents-assistant-fixes-and-streamlining
crickman Feb 18, 2025
f969db7
Namespace
crickman Feb 18, 2025
729bd06
Namespace
crickman Feb 18, 2025
aab75b0
Almost
crickman Feb 18, 2025
1e4e4bc
Namespace / header
crickman Feb 18, 2025
fb04c6b
Integration tests
crickman Feb 18, 2025
66d28c0
Namespace
crickman Feb 18, 2025
162132f
Namespace
crickman Feb 18, 2025
5493b1e
Merge branch 'main' into agents-assistant-fixes-and-streamlining
crickman Feb 18, 2025
5025aa2
Coverage
crickman Feb 18, 2025
13d335e
Refine covered surface area
crickman Feb 18, 2025
5484f94
Namespace
crickman Feb 18, 2025
96ee53e
Test cleanup
crickman Feb 18, 2025
0ce3bcd
More coverage
crickman Feb 18, 2025
0a6b891
Exclude streaming
crickman Feb 18, 2025
2177597
Final
crickman Feb 18, 2025
f1274c4
Fix build
crickman Feb 18, 2025
66b95f4
Update constructor
crickman Feb 18, 2025
b42c88f
Merge branch 'main' into agents-assistant-fixes-and-streamlining
crickman Feb 18, 2025
aa7befa
Namespace
crickman Feb 18, 2025
6d6e2ab
Namespace
crickman Feb 18, 2025
f6067c3
Namespace
crickman Feb 18, 2025
787da66
Merge branch 'main' into agents-assistant-fixes-and-streamlining
crickman Feb 18, 2025
1792fb5
Merge branch 'agents-assistant-fixes-and-streamlining' into agents-gr…
crickman Feb 18, 2025
527986c
Merge branch 'main' into agents-assistant-fixes-and-streamlining
crickman Feb 19, 2025
5ae6ca1
Update metadata
crickman Feb 19, 2025
04805bd
Package suffix
crickman Feb 19, 2025
f0389b1
Merge branch 'agents-assistant-fixes-and-streamlining' into agents-gr…
crickman Feb 19, 2025
773b005
Merge branch 'main' into agents-assistant-fixes-and-streamlining
crickman Feb 19, 2025
8aea63a
Fix integration test
crickman Feb 19, 2025
7180009
Merge branch 'agents-assistant-fixes-and-streamlining' of https://git…
crickman Feb 19, 2025
fa20a90
Merge branch 'agents-assistant-fixes-and-streamlining' into agents-gr…
crickman Feb 19, 2025
f8fc491
Merge branch 'main' into agents-graduation
crickman Feb 19, 2025
f2b90a5
Namespace
crickman Feb 19, 2025
17bc7e7
Merge branch 'main' into agents-graduation
crickman Feb 19, 2025
ad19e14
Warnings
crickman Feb 19, 2025
541b9a0
Remove `AssemblyInfo.cs` stub
crickman Feb 19, 2025
ed456f9
Merge branch 'main' into agents-graduation
crickman Feb 19, 2025
cc9a4ef
Merge branch 'main' into agents-graduation
crickman Feb 20, 2025
119aae4
Merge branch 'main' into agents-graduation
crickman Feb 20, 2025
39bf092
Merge branch 'main' into agents-graduation
crickman Feb 21, 2025
26722ad
Merge branch 'main' into agents-graduation
crickman Feb 21, 2025
719b634
Merge branch 'main' into agents-graduation
crickman Feb 21, 2025
d6bfd27
More experimental targs
crickman Feb 21, 2025
135868a
Merge branch 'main' into agents-graduation
crickman Feb 21, 2025
dc6acf3
Add VersionSuffix property to project file
markwallace-microsoft Feb 24, 2025
2134f61
Add VersionSuffix property to project file
markwallace-microsoft Feb 24, 2025
720a937
Merge branch 'main' into agents-graduation
markwallace-microsoft Feb 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dotnet/src/Agents/Abstractions/Agent.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -64,7 +65,10 @@ public abstract class Agent
/// For example, two OpenAI Assistant agents each targeting a different Azure OpenAI endpoint
/// would require their own channel. In this case, the endpoint could be expressed as an additional key.
/// </remarks>
[Experimental("SKEXP0110")]
#pragma warning disable CA1024 // Use properties where appropriate
protected internal abstract IEnumerable<string> GetChannelKeys();
#pragma warning restore CA1024 // Use properties where appropriate

/// <summary>
/// Produce an <see cref="AgentChannel"/> appropriate for the agent type.
Expand All @@ -75,6 +79,7 @@ public abstract class Agent
/// Every agent conversation, or <see cref="AgentChat"/>, will establish one or more <see cref="AgentChannel"/>
/// objects according to the specific <see cref="Agent"/> type.
/// </remarks>
[Experimental("SKEXP0110")]
protected internal abstract Task<AgentChannel> CreateChannelAsync(CancellationToken cancellationToken);

/// <summary>
Expand All @@ -87,6 +92,7 @@ public abstract class Agent
/// Every agent conversation, or <see cref="AgentChat"/>, will establish one or more <see cref="AgentChannel"/>
/// objects according to the specific <see cref="Agent"/> type.
/// </remarks>
[Experimental("SKEXP0110")]
protected internal abstract Task<AgentChannel> RestoreChannelAsync(string channelState, CancellationToken cancellationToken);

private ILogger? _logger;
Expand Down
3 changes: 3 additions & 0 deletions dotnet/src/Agents/Abstractions/AgentChannel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
Expand All @@ -13,6 +14,7 @@ namespace Microsoft.SemanticKernel.Agents;
/// <remarks>
/// An agent provides it own <see cref="AgentChannel"/> via <see cref="Agent.CreateChannelAsync"/>.
/// </remarks>
[Experimental("SKEXP0110")]
public abstract class AgentChannel
{
/// <summary>
Expand Down Expand Up @@ -83,6 +85,7 @@ protected internal abstract IAsyncEnumerable<StreamingChatMessageContent> Invoke
/// An agent provides it own <see cref="AgentChannel"/> via <see cref="Agent.CreateChannelAsync"/>.
/// This class is a convenience upcast to an agent for <see cref="AgentChannel{TAgent}.InvokeAsync(TAgent, CancellationToken)"/>.
/// </remarks>
[Experimental("SKEXP0110")]
public abstract class AgentChannel<TAgent> : AgentChannel where TAgent : Agent
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/Agents/Abstractions/AgentChat.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text.Json;
Expand All @@ -21,6 +22,7 @@ namespace Microsoft.SemanticKernel.Agents;
/// <see cref="AgentChat" /> instances don't support concurrent invocation and
/// will throw an exception if concurrent activity is attempted for any public method.
/// </remarks>
[Experimental("SKEXP0110")]
public abstract class AgentChat
{
private readonly BroadcastQueue _broadcastQueue;
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/Agents/Abstractions/AgentChatSerializer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
Expand All @@ -11,6 +12,7 @@ namespace Microsoft.SemanticKernel.Agents;
/// <summary>
/// Serializes and deserializes an <see cref="AgentChat"/>.
/// </summary>
[Experimental("SKEXP0110")]
public sealed class AgentChatSerializer
{
private readonly AgentChatState _state;
Expand Down
4 changes: 2 additions & 2 deletions dotnet/src/Agents/Abstractions/Agents.Abstractions.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- THIS PROPERTY GROUP MUST COME FIRST -->
<AssemblyName>Microsoft.SemanticKernel.Agents.Abstractions</AssemblyName>
<RootNamespace>Microsoft.SemanticKernel.Agents</RootNamespace>
<TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks>
<EnablePackageValidation>false</EnablePackageValidation>
<VersionSuffix>alpha</VersionSuffix>
<VersionSuffix>rc</VersionSuffix>
</PropertyGroup>

<Import Project="$(RepoRoot)/dotnet/nuget/nuget-package.props" />
Expand Down
3 changes: 3 additions & 0 deletions dotnet/src/Agents/Abstractions/AggregatorAgent.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -12,6 +13,7 @@ namespace Microsoft.SemanticKernel.Agents;
/// Defines the relationship between the internal aggregated chat and the chat
/// with which <see cref="AggregatorAgent"/> is participating.
/// </summary>
[Experimental("SKEXP0110")]
public enum AggregatorMode
{
/// <summary>
Expand All @@ -29,6 +31,7 @@ public enum AggregatorMode
/// Allows an <see cref="AgentChat"/> to participate in another <see cref="AgentChat"/> as an <see cref="Agent"/>.
/// </summary>
/// <param name="chatProvider">A factory method that produces a new <see cref="AgentChat"/> instance.</param>
[Experimental("SKEXP0110")]
public sealed class AggregatorAgent(Func<AgentChat> chatProvider) : Agent
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/Agents/Abstractions/AggregatorChannel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text.Json;
Expand All @@ -11,6 +12,7 @@ namespace Microsoft.SemanticKernel.Agents;
/// <summary>
/// Adapt channel contract to underlying <see cref="AgentChat"/>.
/// </summary>
[Experimental("SKEXP0110")]
internal sealed class AggregatorChannel(AgentChat chat) : AgentChannel<AggregatorAgent>
{
private readonly AgentChat _chat = chat;
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/Agents/Abstractions/Internal/BroadcastQueue.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using ChannelQueue = System.Collections.Generic.Queue<System.Collections.Generic.IReadOnlyList<Microsoft.SemanticKernel.ChatMessageContent>>;
Expand All @@ -21,6 +22,7 @@ namespace Microsoft.SemanticKernel.Agents.Internal;
/// <see cref="BroadcastQueue"/> is never invoked concurrently, which eliminates
/// race conditions over the queue dictionary.
/// </remarks>
[Experimental("SKEXP0110")]
internal sealed class BroadcastQueue
{
private readonly Dictionary<string, QueueReference> _queues = [];
Expand Down
3 changes: 3 additions & 0 deletions dotnet/src/Agents/Abstractions/Internal/ChannelReference.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// Copyright (c) Microsoft. All rights reserved.
using System.Diagnostics.CodeAnalysis;

namespace Microsoft.SemanticKernel.Agents.Internal;

/// <summary>
/// Tracks channel along with its hashed key.
/// </summary>
[Experimental("SKEXP0110")]
internal readonly struct ChannelReference(AgentChannel channel, string hash)
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace Microsoft.SemanticKernel.Agents;
/// generate logging code at compile time to achieve optimized code.
/// </remarks>
[ExcludeFromCodeCoverage]
[Experimental("SKEXP0110")]
internal static partial class AggregatorAgentLogMessages
{
/// <summary>
Expand Down
6 changes: 0 additions & 6 deletions dotnet/src/Agents/Abstractions/Properties/AssemblyInfo.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text.Json.Serialization;
using Microsoft.SemanticKernel.ChatCompletion;
Expand All @@ -10,6 +11,7 @@ namespace Microsoft.SemanticKernel.Agents.Serialization;
/// Represents a <see cref="ChatMessageContent"/> for serialization without metadata.
/// </summary>
/// <param name="message">The referenced message</param>
[Experimental("SKEXP0110")]
public sealed class ChatMessageReference(ChatMessageContent message)
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/Agents/AzureAI/Agents.AzureAI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks>
<NoWarn>$(NoWarn);SKEXP0110</NoWarn>
<EnablePackageValidation>false</EnablePackageValidation>
<VersionSuffix>alpha</VersionSuffix>
<VersionSuffix>preview</VersionSuffix>
</PropertyGroup>

<Import Project="$(RepoRoot)/dotnet/nuget/nuget-package.props" />
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/Agents/Core/AgentGroupChat.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
Expand All @@ -15,6 +16,7 @@ namespace Microsoft.SemanticKernel.Agents;
/// <summary>
/// Represents an <see cref="AgentChat"/> that supports multi-turn interactions.
/// </summary>
[Experimental("SKEXP0110")]
public sealed class AgentGroupChat : AgentChat
{
private readonly HashSet<string> _agentIds; // Efficient existence test O(1) vs O(n) for list.
Expand Down
5 changes: 2 additions & 3 deletions dotnet/src/Agents/Core/Agents.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- THIS PROPERTY GROUP MUST COME FIRST -->
<AssemblyName>Microsoft.SemanticKernel.Agents.Core</AssemblyName>
<RootNamespace>Microsoft.SemanticKernel.Agents</RootNamespace>
<TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks>
<NoWarn>$(NoWarn);SKEXP0110</NoWarn>
<EnablePackageValidation>false</EnablePackageValidation>
<VersionSuffix>alpha</VersionSuffix>
<VersionSuffix>rc</VersionSuffix>
</PropertyGroup>

<Import Project="$(RepoRoot)/dotnet/nuget/nuget-package.props" />
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/Agents/Core/Chat/AgentGroupChatSettings.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;

Expand All @@ -11,6 +12,7 @@ namespace Microsoft.SemanticKernel.Agents.Chat;
/// <remarks>
/// The default behavior results in no agent selection.
/// </remarks>
[Experimental("SKEXP0110")]
public class AgentGroupChatSettings
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -9,6 +10,7 @@ namespace Microsoft.SemanticKernel.Agents.Chat;
/// <summary>
/// Defines aggregation behavior for <see cref="AggregatorTerminationStrategy"/>.
/// </summary>
[Experimental("SKEXP0110")]
public enum AggregateTerminationCondition
{
/// <summary>
Expand All @@ -26,6 +28,7 @@ public enum AggregateTerminationCondition
/// Provides methods to aggregate a set of <see cref="TerminationStrategy"/> objects.
/// </summary>
/// <param name="strategies">The set of strategies upon which to aggregate.</param>
[Experimental("SKEXP0110")]
public sealed class AggregatorTerminationStrategy(params TerminationStrategy[] strategies) : TerminationStrategy
{
private readonly TerminationStrategy[] _strategies = strategies;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -15,6 +16,7 @@ namespace Microsoft.SemanticKernel.Agents.Chat;
/// </summary>
/// <param name="function">A <see cref="KernelFunction"/> used for selection criteria.</param>
/// <param name="kernel">A kernel instance with services for function execution.</param>
[Experimental("SKEXP0110")]
public class KernelFunctionSelectionStrategy(KernelFunction function, Kernel kernel) : SelectionStrategy
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -15,6 +16,7 @@ namespace Microsoft.SemanticKernel.Agents.Chat;
/// </summary>
/// <param name="function">A <see cref="KernelFunction"/> used for termination criteria.</param>
/// <param name="kernel">A kernel instance with services for function execution.</param>
[Experimental("SKEXP0110")]
public class KernelFunctionTerminationStrategy(KernelFunction function, Kernel kernel) : TerminationStrategy
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/Agents/Core/Chat/RegExTerminationStrategy.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
Expand All @@ -11,6 +12,7 @@ namespace Microsoft.SemanticKernel.Agents.Chat;
/// Signals termination when the most recent message matches against the defined regular expressions
/// for the specified agent (if provided).
/// </summary>
[Experimental("SKEXP0110")]
public sealed class RegexTerminationStrategy : TerminationStrategy
{
private readonly Regex[] _expressions;
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/Agents/Core/Chat/SelectionStrategy.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
Expand All @@ -10,6 +11,7 @@ namespace Microsoft.SemanticKernel.Agents.Chat;
/// <summary>
/// Provides a base strategy class for selecting the next agent for an <see cref="AgentGroupChat"/>.
/// </summary>
[Experimental("SKEXP0110")]
public abstract class SelectionStrategy
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/Agents/Core/Chat/SequentialSelectionStrategy.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.SemanticKernel.Agents.Extensions;
Expand All @@ -10,6 +11,7 @@ namespace Microsoft.SemanticKernel.Agents.Chat;
/// Represents a round-robin turn-taking strategy. Agent order is based on the order
/// in which they joined <see cref="AgentGroupChat"/>.
/// </summary>
[Experimental("SKEXP0110")]
public sealed class SequentialSelectionStrategy : SelectionStrategy
{
private int _index = -1;
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/Agents/Core/Chat/TerminationStrategy.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -12,6 +13,7 @@ namespace Microsoft.SemanticKernel.Agents.Chat;
/// <summary>
/// Provides a base strategy class for defining termination criteria for an <see cref="AgentGroupChat"/>.
/// </summary>
[Experimental("SKEXP0110")]
public abstract class TerminationStrategy
{
/// <summary>
Expand Down
Loading
Loading