Skip to content

A programming framework for agentic AI

.NET update global.json to use 9.0.100 (#5517)

Xiaoyun Zhang7f0acd78a88b
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 20d26f7ee..8a76bde68 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -106,6 +106,11 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
+ - if: matrix.build-mode == 'manual'
+ name: Setup .NET 9.0
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '9.0.x'
- if: matrix.build-mode == 'manual'
shell: bash
working-directory: dotnet
diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml
index a485f9ddd..3d83bdf39 100644
--- a/.github/workflows/dotnet-build.yml
+++ b/.github/workflows/dotnet-build.yml
@@ -81,6 +81,10 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
+ - name: Setup .NET 9.0
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '9.0.x'
- name: Restore dependencies
run: dotnet restore -bl
- name: Format check
@@ -207,6 +211,10 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
+ - name: Setup .NET 9.0
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '9.0.x'
- name: publish AOT testApp, assert static analysis warning count, and run the app
shell: pwsh
@@ -249,6 +257,10 @@ jobs:
with:
dotnet-version: '8.0.x'
global-json-file: dotnet/global.json
+ - name: Setup .NET 9.0
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '9.0.x'
- name: Install dev certs
run: dotnet --version && dotnet dev-certs https --trust
- name: Restore dependencies
diff --git a/dotnet/.tools/test-aot-compatibility.ps1 b/dotnet/.tools/test-aot-compatibility.ps1
index d70139fd1..2579d3fef 100644
--- a/dotnet/.tools/test-aot-compatibility.ps1
+++ b/dotnet/.tools/test-aot-compatibility.ps1
@@ -15,7 +15,7 @@ foreach ($line in $($publishOutput -split "`r`n"))
}
}
-pushd $rootDirectory/artifacts/bin/AutoGen.AotCompatibility.Tests/release
+pushd $rootDirectory/artifacts/bin/AutoGen.AotCompatibility.Tests/release/native
Write-Host "Executing test App..."
./AutoGen.AotCompatibility.Tests
diff --git a/dotnet/global.json b/dotnet/global.json
index 4f9e9b79a..cdbb589ed 100644
--- a/dotnet/global.json
+++ b/dotnet/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "8.0.401",
- "rollForward": "latestMinor"
+ "version": "9.0.100",
+ "rollForward": "latestFeature"
}
}
diff --git a/dotnet/samples/AgentChat/AutoGen.OpenAI.Sample/Tool_Call_With_Ollama_And_LiteLLM.cs b/dotnet/samples/AgentChat/AutoGen.OpenAI.Sample/Tool_Call_With_Ollama_And_LiteLLM.cs
index 05c09f49d..687281b32 100644
--- a/dotnet/samples/AgentChat/AutoGen.OpenAI.Sample/Tool_Call_With_Ollama_And_LiteLLM.cs
+++ b/dotnet/samples/AgentChat/AutoGen.OpenAI.Sample/Tool_Call_With_Ollama_And_LiteLLM.cs
@@ -42,8 +42,6 @@ public class Tool_Call_With_Ollama_And_LiteLLM
});
#endregion Create_tools
#region Create_Agent
- var liteLLMUrl = "http://localhost:4000";
-
// api-key is not required for local server
// so you can use any string here
var openAIClient = new OpenAIClient(new ApiKeyCredential("api-key"), new OpenAIClientOptions
@@ -59,7 +57,7 @@ public class Tool_Call_With_Ollama_And_LiteLLM
.RegisterMiddleware(functionMiddleware)
.RegisterPrintMessage();
- var reply = await agent.SendAsync("what's the weather in new york");
+ await agent.SendAsync("what's the weather in new york");
#endregion Create_Agent
}
}
diff --git a/dotnet/samples/AgentChat/AutoGen.WebAPI.Sample/Program.cs b/dotnet/samples/AgentChat/AutoGen.WebAPI.Sample/Program.cs
index 18ce4b023..315ac0055 100644
--- a/dotnet/samples/AgentChat/AutoGen.WebAPI.Sample/Program.cs
+++ b/dotnet/samples/AgentChat/AutoGen.WebAPI.Sample/Program.cs
@@ -40,6 +40,6 @@ public class DummyAgent : IStreamingAgent
foreach (var c in reply)
{
yield return new TextMessageUpdate(Role.Assistant, c.ToString(), this.Name);
- };
+ }
}
}
diff --git a/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/ChatAgent.cs b/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/ChatAgent.cs
index 6cad4f88d..b4cf2f738 100644
--- a/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/ChatAgent.cs
+++ b/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/ChatAgent.cs
@@ -170,24 +170,23 @@ public interface IChatAgent :
/// <summary>
/// The name of the agent. This is used by team to uniquely identify the agent.It should be unique within the team.
/// </summary>
- AgentName Name { get; }
+ public AgentName Name { get; }
/// <summary>
/// The description of the agent. This is used by team to make decisions about which agents to use.The description
/// should describe the agent's capabilities and how to interact with it.
/// </summary>
- string Description { get; }
+ public string Description { get; }
/// <summary>
/// The types of messages that the agent produces.
/// </summary>
- IEnumerable<Type> ProducedMessageTypes { get; } // TODO: Is there a way to make this part of the type somehow?
- // Annotations, or IProduce<>? Do we ever actually access this?
+ public IEnumerable<Type> ProducedMessageTypes { get; } // TODO: Is there a way to make this part of the type somehow? Annotations, or IProduce<>? Do we ever actually access this?
/// <summary>
/// Reset the agent to its initialization state.
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
- ValueTask ResetAsync(CancellationToken cancellationToken);
+ public ValueTask ResetAsync(CancellationToken cancellationToken);
}
diff --git a/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/MessageHandling.cs b/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/MessageHandling.cs
index 4183723e8..4239e6135 100644
--- a/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/MessageHandling.cs
+++ b/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/MessageHandling.cs
@@ -5,22 +5,22 @@ namespace Microsoft.AutoGen.AgentChat.Abstractions;
public interface IHandleChat<in TIn>
{
- ValueTask HandleAsync(TIn item)
+ public ValueTask HandleAsync(TIn item)
{
return this.HandleAsync(item, CancellationToken.None);
}
- ValueTask HandleAsync(TIn item, CancellationToken cancellationToken);
+ public ValueTask HandleAsync(TIn item, CancellationToken cancellationToken);
}
public interface IHandleChat<in TIn, TOut> // TODO: Map this to IHandle<> somehow?
{
- ValueTask<TOut> HandleAsync(TIn item)
+ public ValueTask<TOut> HandleAsync(TIn item)
{
return this.HandleAsync(item, CancellationToken.None);
}
- ValueTask<TOut> HandleAsync(TIn item, CancellationToken cancellationToken);
+ public ValueTask<TOut> HandleAsync(TIn item, CancellationToken cancellationToken);
}
public interface IHandleDefault : IHandleChat<object>
@@ -29,10 +29,10 @@ public interface IHandleDefault : IHandleChat<object>
public interface IHandleStream<in TIn, TOut>
{
- IAsyncEnumerable<TOut> StreamAsync(TIn item)
+ public IAsyncEnumerable<TOut> StreamAsync(TIn item)
{
return this.StreamAsync(item, CancellationToken.None);
}
- IAsyncEnumerable<TOut> StreamAsync(TIn item, CancellationToken cancellationToken);
+ public IAsyncEnumerable<TOut> StreamAsync(TIn item, CancellationToken cancellationToken);
}
diff --git a/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Tasks.cs b/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Tasks.cs
index 2b4d66d93..1c11bbaa6 100644
--- a/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Tasks.cs
+++ b/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Tasks.cs
@@ -59,7 +59,7 @@ public interface ITaskRunner
/// <param name="task">The task definition in text form.</param>
/// <param name="cancellationToken"></param>
/// <returns>The result of running the task.</returns>
- async ValueTask<TaskResult> RunAsync(string task, CancellationToken cancellationToken = default) =>
+ public async ValueTask<TaskResult> RunAsync(string task, CancellationToken cancellationToken = default) =>
await this.RunAsync(ToMessage(task)!, cancellationToken);
/// <summary>
@@ -73,7 +73,7 @@ public interface ITaskRunner
/// <param name="cancellationToken"></param>
/// <returns>The result of running the task.</returns>
/// <exception cref="InvalidOperationException">If no response is generated.</exception>
- async ValueTask<TaskResult> RunAsync(ChatMessage task, CancellationToken cancellationToken = default)
+ public async ValueTask<TaskResult> RunAsync(ChatMessage task, CancellationToken cancellationToken = default)
{
await foreach (TaskFrame frame in this.StreamAsync(task, cancellationToken))
{
@@ -98,7 +98,7 @@ public interface ITaskRunner
/// <param name="cancellationToken"></param>
/// <returns>A stream of <see cref="TaskFrame"/> containing internal messages and intermediate results followed by
/// the final <see cref="TaskResult"/></returns>
- IAsyncEnumerable<TaskFrame> StreamAsync(string task, CancellationToken cancellationToken = default) =>
+ public IAsyncEnumerable<TaskFrame> StreamAsync(string task, CancellationToken cancellationToken = default) =>
this.StreamAsync(ToMessage(task), cancellationToken);
/// <summary>
@@ -113,5 +113,5 @@ public interface ITaskRunner
/// <param name="cancellationToken"></param>
/// <returns>A stream of <see cref="TaskFrame"/> containing internal messages and intermediate results followed by
/// the final <see cref="TaskResult"/></returns>
- IAsyncEnumerable<TaskFrame> StreamAsync(ChatMessage? task, CancellationToken cancellationToken = default);
+ public IAsyncEnumerable<TaskFrame> StreamAsync(ChatMessage? task, CancellationToken cancellationToken = default);
}
diff --git a/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Termination.cs b/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Termination.cs
index f5cb00cfe..352b25298 100644
--- a/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Termination.cs
+++ b/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Termination.cs
@@ -19,7 +19,7 @@ public interface ITerminationCondition
/// <summary>
/// Checks if the termination condition has been reached
/// </summary>
- bool IsTerminated { get; }
+ public bool IsTerminated { get; }
/// <summary>
/// Check if the conversation should be terminated based on the messages received
@@ -30,19 +30,19 @@ public interface ITerminationCondition
/// <returns>A <see cref="StopMessage"/> if the conversation should be terminated, or <c>null</c>
/// otherwise.</returns>
/// <exception cref="TerminatedException">If the termination condition has already been reached.</exception>
- ValueTask<StopMessage?> CheckAndUpdateAsync(IList<AgentMessage> messages);
+ public ValueTask<StopMessage?> CheckAndUpdateAsync(IList<AgentMessage> messages);
/// <summary>
/// Resets the termination condition.
/// </summary>
- void Reset();
+ public void Reset();
/// <summary>
/// Combine this termination condition with another using a logical OR.
/// </summary>
/// <param name="other">Another termination condition.</param>
/// <returns>The combined termination condition, with appropriate short-circuiting.</returns>
- ITerminationCondition Or(ITerminationCondition other)
+ public ITerminationCondition Or(ITerminationCondition other)
{
return new CombinerCondition(CombinerCondition.Or, this, other);
}
@@ -52,7 +52,7 @@ public interface ITerminationCondition
/// </summary>
/// <param name="other">Another termination condition.</param>
/// <returns>The combined termination condition, with appropriate short-circuiting.</returns>
- ITerminationCondition And(ITerminationCondition other)
+ public ITerminationCondition And(ITerminationCondition other)
{
return new CombinerCondition(CombinerCondition.And, this, other);
}
diff --git a/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Tools.cs b/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Tools.cs
index fe10182d1..1c0c276b7 100644
--- a/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Tools.cs
+++ b/dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Tools.cs
@@ -82,8 +82,8 @@ public class ParameterSchema<T>(string name, bool isRequired = false, T? default
/// </summary>
public interface ITool
{
- string Name { get; }
- string Description { get; }
+ public string Name { get; }
+ public string Description { get; }
public IEnumerable<ParameterSchema> Parameters { get; }
public Type ReturnType { get; }
diff --git a/dotnet/src/Microsoft.AutoGen/AgentChat/GroupChat/GroupChatBase.cs b/dotnet/src/Microsoft.AutoGen/AgentChat/GroupChat/GroupChatBase.cs
index 5192cac6d..f6ec12ca8 100644
--- a/dotnet/src/Microsoft.AutoGen/AgentChat/GroupChat/GroupChatBase.cs
+++ b/dotnet/src/Microsoft.AutoGen/AgentChat/GroupChat/GroupChatBase.cs
@@ -114,7 +114,7 @@ public abstract class GroupChatBase<TManager> : ITeam where TManager : GroupChat
if (Activator.CreateInstance(typeof(TManager), options) is TManager result)
{
return result;
- };
+ }
}
catch (TargetInvocationException tie)
{
diff --git a/dotnet/src/Microsoft.AutoGen/AgentChat/GroupChat/GroupChatHandlerRouter.cs b/dotnet/src/Microsoft.AutoGen/AgentChat/GroupChat/GroupChatHandlerRouter.cs
index 9855dcafb..fabcc574d 100644
--- a/dotnet/src/Microsoft.AutoGen/AgentChat/GroupChat/GroupChatHandlerRouter.cs
+++ b/dotnet/src/Microsoft.AutoGen/AgentChat/GroupChat/GroupChatHandlerRouter.cs
@@ -11,8 +11,8 @@ internal delegate ValueTask MessagePublishServicer(GroupChatEventBase event_, st
internal interface IGroupChatHandler : IHandle<GroupChatStart>, IHandle<GroupChatAgentResponse>, IHandle<object>
{
- void AttachMessagePublishServicer(MessagePublishServicer? servicer = null);
- void DetachMessagePublishServicer() => this.AttachMessagePublishServicer(null);
+ public void AttachMessagePublishServicer(MessagePublishServicer? servicer = null);
+ public void DetachMessagePublishServicer() => this.AttachMessagePublishServicer(null);
}
internal sealed class GroupChatHandlerRouter<TManager> : HostableAgentAdapter,
diff --git a/dotnet/src/Microsoft.AutoGen/AgentChat/GroupChat/OutputCollectorAgent.cs b/dotnet/src/Microsoft.AutoGen/AgentChat/GroupChat/OutputCollectorAgent.cs
index d17fa266b..3c9fd6101 100644
--- a/dotnet/src/Microsoft.AutoGen/AgentChat/GroupChat/OutputCollectorAgent.cs
+++ b/dotnet/src/Microsoft.AutoGen/AgentChat/GroupChat/OutputCollectorAgent.cs
@@ -11,8 +11,8 @@ namespace Microsoft.AutoGen.AgentChat.Abstractions;
internal interface IOutputCollectionSink
{
- void CollectMessage(AgentMessage message);
- void Terminate(StopMessage message);
+ public void CollectMessage(AgentMessage message);
+ public void Terminate(StopMessage message);
}
internal sealed class OutputSink : IOutputCollectionSink
diff --git a/dotnet/src/Microsoft.AutoGen/Core.Grpc/GrpcMessageRouter.cs b/dotnet/src/Microsoft.AutoGen/Core.Grpc/GrpcMessageRouter.cs
index 32317cbc7..26d3827b0 100644
--- a/dotnet/src/Microsoft.AutoGen/Core.Grpc/GrpcMessageRouter.cs
+++ b/dotnet/src/Microsoft.AutoGen/Core.Grpc/GrpcMessageRouter.cs
@@ -43,7 +43,7 @@ internal sealed class AutoRestartChannel : IDisposable
if (this.RecreateChannel(null) == null)
{
throw new Exception("Failed to connect to gRPC endpoint.");
- };
+ }
}
public AsyncDuplexStreamingCall<Message, Message> StreamingCall
@@ -117,8 +117,9 @@ internal sealed class GrpcMessageRouter(AgentRpc.AgentRpcClient client,
private readonly CancellationTokenSource _shutdownCts = CancellationTokenSource.CreateLinkedTokenSource(shutdownCancellation);
private readonly IMessageSink<Message> _incomingMessageSink = incomingMessageSink;
+
+ // TODO: Enable a way to configure the channel options
private readonly Channel<(Message Message, TaskCompletionSource WriteCompletionSource)> _outboundMessagesChannel
- // TODO: Enable a way to configure the channel options
= Channel.CreateBounded<(Message, TaskCompletionSource)>(DefaultChannelOptions);
private readonly AutoRestartChannel _incomingMessageChannel = new AutoRestartChannel(client, clientId, logger, shutdownCancellation);
diff --git a/dotnet/src/Microsoft.AutoGen/Core/ResultSink.cs b/dotnet/src/Microsoft.AutoGen/Core/ResultSink.cs
index d103bdfda..ef8958366 100644
--- a/dotnet/src/Microsoft.AutoGen/Core/ResultSink.cs
+++ b/dotnet/src/Microsoft.AutoGen/Core/ResultSink.cs
@@ -7,11 +7,11 @@ namespace Microsoft.AutoGen.Core;
internal interface IResultSink<TResult> : IValueTaskSource<TResult>
{
- void SetResult(TResult result);
- void SetException(Exception exception);
- void SetCancelled();
+ public void SetResult(TResult result);
+ public void SetException(Exception exception);
+ public void SetCancelled();
- ValueTask<TResult> Future { get; }
+ public ValueTask<TResult> Future { get; }
}
public sealed class ResultSink<TResult> : IResultSink<TResult>
diff --git a/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcGateway.cs b/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcGateway.cs
index e657ac36f..97bc8df3f 100644
--- a/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcGateway.cs
+++ b/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcGateway.cs
@@ -243,7 +243,7 @@ public sealed class GrpcGateway : BackgroundService, IGateway
default:
await RespondBadRequestAsync(connection, $"Unknown message type for message '{message}'.");
break;
- };
+ }
}
/// <summary>
diff --git a/dotnet/test/AutoGen.AotCompatibility.Tests/AutoGen.AotCompatibility.Tests.csproj b/dotnet/test/AutoGen.AotCompatibility.Tests/AutoGen.AotCompatibility.Tests.csproj
index 379bca541..aec9660bb 100644
--- a/dotnet/test/AutoGen.AotCompatibility.Tests/AutoGen.AotCompatibility.Tests.csproj
+++ b/dotnet/test/AutoGen.AotCompatibility.Tests/AutoGen.AotCompatibility.Tests.csproj
@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
- <TargetFramework>net8.0</TargetFramework>
+ <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
diff --git a/dotnet/test/AutoGen.Tests/MiddlewareTest.cs b/dotnet/test/AutoGen.Tests/MiddlewareTest.cs
index 564406ec7..7dd48fec6 100644
--- a/dotnet/test/AutoGen.Tests/MiddlewareTest.cs
+++ b/dotnet/test/AutoGen.Tests/MiddlewareTest.cs
@@ -72,7 +72,7 @@ public partial class MiddlewareTest
public async Task FunctionCallMiddlewareTestAsync()
{
var agent = new EchoAgent("echo");
- var args = new EchoSchema { message = "hello" };
+ var args = new AutoGen.Tests.MiddlewareTest.EchoSchema { message = "hello" }; // make the format check happy on linux
var argsJson = JsonSerializer.Serialize(args) ?? throw new InvalidOperationException("Failed to serialize args");
var functionCall = new ToolCall("Echo", argsJson);
var functionCallAgent = agent.RegisterMiddleware(async (messages, options, agent, ct) =>
diff --git a/dotnet/test/Microsoft.AutoGen.Core.Grpc.Tests/TestGrpcWorkerConnection.cs b/dotnet/test/Microsoft.AutoGen.Core.Grpc.Tests/TestGrpcWorkerConnection.cs
index 20b8169db..2a4d9ea0a 100644
--- a/dotnet/test/Microsoft.AutoGen.Core.Grpc.Tests/TestGrpcWorkerConnection.cs
+++ b/dotnet/test/Microsoft.AutoGen.Core.Grpc.Tests/TestGrpcWorkerConnection.cs
@@ -92,7 +92,7 @@ internal sealed class TestGrpcWorkerConnection : IAsyncDisposable
default:
// if it wasn't recognized return bad request
throw new RpcException(new Status(StatusCode.InvalidArgument, $"Unknown message type for message '{message}'"));
- };
+ }
}
}
catch (OperationCanceledException)