db620d33df
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled
CodeQL / Analyze (csharp) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
53 lines
2.2 KiB
C#
53 lines
2.2 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using AGUIDojoServer;
|
|
using Microsoft.Agents.AI.Hosting.AGUI.AspNetCore;
|
|
using Microsoft.AspNetCore.HttpLogging;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Services.AddHttpLogging(logging =>
|
|
{
|
|
logging.LoggingFields = HttpLoggingFields.RequestPropertiesAndHeaders | HttpLoggingFields.RequestBody
|
|
| HttpLoggingFields.ResponsePropertiesAndHeaders | HttpLoggingFields.ResponseBody;
|
|
logging.RequestBodyLogLimit = int.MaxValue;
|
|
logging.ResponseBodyLogLimit = int.MaxValue;
|
|
});
|
|
|
|
builder.Services.AddHttpClient().AddLogging();
|
|
builder.Services.ConfigureHttpJsonOptions(options => options.SerializerOptions.TypeInfoResolverChain.Add(AGUIDojoServerSerializerContext.Default));
|
|
builder.Services.AddAGUIServer();
|
|
|
|
// WARNING: When adding session persistence (e.g., WithInMemorySessionStore), or running in production,
|
|
// make sure to also register a SessionIsolationKeyProvider to scope sessions by principal in multi-user
|
|
// deployments, e.g.:
|
|
// builder.Services.UseClaimsBasedSessionIsolation(new() { ClaimType = ClaimTypes.NameIdentifier });
|
|
|
|
WebApplication app = builder.Build();
|
|
|
|
app.UseHttpLogging();
|
|
|
|
// Initialize the factory
|
|
ChatClientAgentFactory.Initialize(app.Configuration);
|
|
|
|
// Map the AG-UI agent endpoints for different scenarios
|
|
app.MapAGUIServer("/agentic_chat", ChatClientAgentFactory.CreateAgenticChat());
|
|
|
|
app.MapAGUIServer("/backend_tool_rendering", ChatClientAgentFactory.CreateBackendToolRendering());
|
|
|
|
app.MapAGUIServer("/human_in_the_loop", ChatClientAgentFactory.CreateHumanInTheLoop());
|
|
|
|
app.MapAGUIServer("/tool_based_generative_ui", ChatClientAgentFactory.CreateToolBasedGenerativeUI());
|
|
|
|
var jsonOptions = app.Services.GetRequiredService<IOptions<Microsoft.AspNetCore.Http.Json.JsonOptions>>();
|
|
app.MapAGUIServer("/agentic_generative_ui", ChatClientAgentFactory.CreateAgenticUI(jsonOptions.Value.SerializerOptions));
|
|
|
|
app.MapAGUIServer("/shared_state", ChatClientAgentFactory.CreateSharedState(jsonOptions.Value.SerializerOptions));
|
|
|
|
app.MapAGUIServer("/predictive_state_updates", ChatClientAgentFactory.CreatePredictiveStateUpdates(jsonOptions.Value.SerializerOptions));
|
|
|
|
await app.RunAsync();
|
|
|
|
public partial class Program;
|