Files
agent-framework/dotnet/samples/HelloHttpApi/HelloHttpApi.ApiService/Program.cs
T
Aditya Mandaleeka f5b35d8403 .NET: CosmosDB Actor State Storage (#262)
* Implement CosmosDB actor state storage.

* Fix.

* Minor fixes.

* Fixes.

* Make CosmosDB initialization be lazy.

* Remove unnecessary read from write path.

* Throw on empty writes.

* Add arg validation for read.

* Add CosmosIdSanitizer.

* Fix.

* Fix.

* Simplify doc IDs.

* Update comment.

* fb

* Make LazyCosmosContainer internal and add tests.

* Make test constants public and remove IVT.

* Use source generated JSON context for future nativeAOT support.

* Re-add dropped comments.
2025-08-05 00:11:49 +00:00

36 lines
835 B
C#

// Copyright (c) Microsoft. All rights reserved.
using HelloHttpApi.ApiService;
using HelloHttpApi.ApiService.Utilities;
var builder = WebApplication.CreateBuilder(args);
// Add service defaults & Aspire client integrations.
builder.AddServiceDefaults();
// Add CosmosDB client integration
builder.AddAzureCosmosClient("hello-http-api-cosmosdb");
// Add services to the container.
builder.Services.AddProblemDetails();
// Configure the chat model and our agent.
builder.AddKeyedChatClient("chat-model");
builder.AddAIAgent(
name: "pirate",
instructions: "You are a pirate. Speak like a pirate.",
chatClientKey: "chat-model");
var app = builder.Build();
// Configure the HTTP request pipeline.
app.UseExceptionHandler();
// Map the agents HTTP endpoints
app.MapAgents();
app.MapDefaultEndpoints();
app.Run();