// Copyright (c) Microsoft Corporation. All rights reserved. // Program.cs using Microsoft.AutoGen.Core; using Microsoft.AutoGen.Contracts; using Microsoft.Extensions.DependencyInjection.Extensions; using Samples; using TerminationF = System.Func; using ModifyF = System.Func; ModifyF modifyFunc = (int x) => x - 1; TerminationF runUntilFunc = (int x) => { return x <= 1; }; AgentsAppBuilder appBuilder = new AgentsAppBuilder(); appBuilder.Services.TryAddSingleton(modifyFunc); appBuilder.Services.TryAddSingleton(runUntilFunc); appBuilder.AddAgent("Checker"); appBuilder.AddAgent("Modifier"); var app = await appBuilder.BuildAsync(); // Send the initial count to the agents app, running on the `local` runtime, and pass through the registered services via the application `builder` await app.PublishMessageAsync(new CountMessage { Content = 10 }, new TopicId("default")); // Run until application shutdown await app.WaitForShutdownAsync();