Galosys.Foundation.Agents.AI.Hosting.AspNetCore 26.8.26.1

dotnet add package Galosys.Foundation.Agents.AI.Hosting.AspNetCore --version 26.8.26.1
                    
NuGet\Install-Package Galosys.Foundation.Agents.AI.Hosting.AspNetCore -Version 26.8.26.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Galosys.Foundation.Agents.AI.Hosting.AspNetCore" Version="26.8.26.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Galosys.Foundation.Agents.AI.Hosting.AspNetCore" Version="26.8.26.1" />
                    
Directory.Packages.props
<PackageReference Include="Galosys.Foundation.Agents.AI.Hosting.AspNetCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Galosys.Foundation.Agents.AI.Hosting.AspNetCore --version 26.8.26.1
                    
#r "nuget: Galosys.Foundation.Agents.AI.Hosting.AspNetCore, 26.8.26.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Galosys.Foundation.Agents.AI.Hosting.AspNetCore@26.8.26.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Galosys.Foundation.Agents.AI.Hosting.AspNetCore&version=26.8.26.1
                    
Install as a Cake Addin
#tool nuget:?package=Galosys.Foundation.Agents.AI.Hosting.AspNetCore&version=26.8.26.1
                    
Install as a Cake Tool

Galosys.Foundation.Agents.AI.Hosting.AspNetCore

Agent ASP.NET Core 托管模块。为 Galosys.Foundation.Agents.AI 创建的智能体提供 ASP.NET Core 托管管道,集成 OpenAI Responses/Conversations、DevUI 调试面板、A2A 智能体间协议和 AGUI 前端 Chat UI。依赖基础模块 Galosys.Foundation.Agents.AI.Hosting

安装

<PackageReference Include="Galosys.Foundation.Agents.AI.Hosting.AspNetCore" />

注册

builder.Services.AddAgentsAI(builder.Configuration);
builder.Services.AddAgentsHosting();

AddAgentsHosting() 内部调用:

  • AddOpenAIResponses() + AddOpenAIConversations() — OpenAI 托管端点
  • AddDevUI() — 开发者调试面板
  • AddA2AServer("default") — A2A 智能体间协议
  • AddAGUI() — 前端 Chat UI

中间件

var app = builder.Build();
app.UseAgentsHosting();

UseAgentsHosting() 自动映射:

  • MapOpenAIResponses() + MapOpenAIConversations() — OpenAI 端点
  • MapA2AHttpJson("default", "/a2a") — A2A 协议端点
  • MapAGUI("default", "/agui") — AGUI Chat UI 端点
  • MapDevUI() — 仅在开发环境启用
  • MapAgentsCost() — 成本报表端点 /agents/cost

成本报表端点

UseAgentsHosting() 会自动映射 GET /agents/cost,实时读取 gen_ai.client.token.usage 指标快照(MAF OpenTelemetryAgent 经 MEAI 输出)并按会话/Agent/模型/用户/租户维度聚合返回 JSON。无指标时返回空数组(HTTP 200)。

GET /agents/cost
x-tenant-id: tenant-a

聚合维度:

  • 会话/Agent/模型:取自 gen_ai.* tag(gen_ai.conversation.id/gen_ai.agent.id/gen_ai.response.model
  • 用户:取自 ClaimsPrincipal(未认证为 anonymous
  • 租户:取自请求头 x-tenant-id(缺省为空)

该端点不落库、不发布事件,仅读取内存指标快照。

注:成本报表读取需 MAF Agent 运行 OpenTelemetryAgentAddOpenTelemetryCore 已默认注册其 meter/source)。UseAgentsHosting() 在应用启动时预解析 AgentsCostReport,确保其 MeterProvider 在 Agent 运行前即开始监听 token 指标。

依赖

  • Galosys.Foundation.Core — 基础设施
  • Galosys.Foundation.Agents.AI — Agent 核心模块
  • Galosys.Foundation.Agents.AI.Hosting — Hosting 基础模块(worker/控制台托管)
  • opentelemetryMeterProvider 读取成本指标
  • Microsoft.Agents.AI.Hosting.OpenAI — OpenAI 托管
  • Microsoft.Agents.AI.DevUI — DevUI 调试面板
  • Microsoft.Agents.AI.Hosting.A2A.AspNetCore — A2A 智能体间协议
  • Microsoft.Agents.AI.Hosting.AGUI.AspNetCore — AGUI 前端 Chat UI
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
26.8.26.1 42 8/26/2026
26.8.23.1 51 8/23/2026
26.8.21.1 54 8/21/2026
26.8.20.1 55 8/20/2026
26.8.18.1 56 8/18/2026
26.8.17.1 60 8/17/2026
26.8.13.2 59 8/13/2026
26.8.13.1 64 8/13/2026
26.8.12.2 63 8/12/2026
26.8.12.1 65 8/12/2026
26.8.10.1 64 8/10/2026
26.8.5.1 67 8/5/2026
26.8.4.1 61 8/4/2026