Skip to content

Commit 7093034

Browse files
committed
back AgentsApp off of ASPNET
1 parent 6215c5d commit 7093034

File tree

1 file changed

+5
-8
lines changed
  • dotnet/src/Microsoft.AutoGen/Core

1 file changed

+5
-8
lines changed

dotnet/src/Microsoft.AutoGen/Core/App.cs

+5-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Diagnostics;
44
using System.Diagnostics.CodeAnalysis;
55
using Google.Protobuf;
6-
using Microsoft.AspNetCore.Builder;
76
using Microsoft.Extensions.DependencyInjection;
87
using Microsoft.Extensions.DependencyInjection.Extensions;
98
using Microsoft.Extensions.Hosting;
@@ -13,27 +12,25 @@ namespace Microsoft.AutoGen.Core;
1312
public static class AgentsApp
1413
{
1514
// need a variable to store the runtime instance
16-
public static WebApplication? Host { get; private set; }
15+
public static IHost? Host { get; private set; }
1716

1817
[MemberNotNull(nameof(Host))]
19-
public static async ValueTask<WebApplication> StartAsync(WebApplicationBuilder? builder = null, AgentTypes? agentTypes = null)
18+
public static async ValueTask<IHost> StartAsync(HostApplicationBuilder? builder = null, AgentTypes? agentTypes = null)
2019
{
21-
builder ??= WebApplication.CreateBuilder();
20+
builder ??= new HostApplicationBuilder();
2221
builder.Services.TryAddSingleton(DistributedContextPropagator.Current);
2322
builder.AddAgentWorker()
2423
.AddAgents(agentTypes);
25-
builder.AddServiceDefaults();
2624
var app = builder.Build();
2725

28-
app.MapDefaultEndpoints();
2926
Host = app;
3027
await app.StartAsync().ConfigureAwait(false);
3128
return Host;
3229
}
33-
public static async ValueTask<WebApplication> PublishMessageAsync(
30+
public static async ValueTask<IHost> PublishMessageAsync(
3431
string topic,
3532
IMessage message,
36-
WebApplicationBuilder? builder = null,
33+
HostApplicationBuilder? builder = null,
3734
AgentTypes? agents = null,
3835
bool local = false)
3936
{

0 commit comments

Comments
 (0)