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
<PackageReference Include="Galosys.Foundation.Agents.AI.Hosting.AspNetCore" Version="26.8.26.1" />
<PackageVersion Include="Galosys.Foundation.Agents.AI.Hosting.AspNetCore" Version="26.8.26.1" />
<PackageReference Include="Galosys.Foundation.Agents.AI.Hosting.AspNetCore" />
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"
#:package Galosys.Foundation.Agents.AI.Hosting.AspNetCore@26.8.26.1
#addin nuget:?package=Galosys.Foundation.Agents.AI.Hosting.AspNetCore&version=26.8.26.1
#tool nuget:?package=Galosys.Foundation.Agents.AI.Hosting.AspNetCore&version=26.8.26.1
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 运行
OpenTelemetryAgent(AddOpenTelemetryCore已默认注册其 meter/source)。UseAgentsHosting()在应用启动时预解析AgentsCostReport,确保其 MeterProvider 在 Agent 运行前即开始监听 token 指标。
依赖
Galosys.Foundation.Core— 基础设施Galosys.Foundation.Agents.AI— Agent 核心模块Galosys.Foundation.Agents.AI.Hosting— Hosting 基础模块(worker/控制台托管)opentelemetry—MeterProvider读取成本指标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 | Versions 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. |
-
net10.0
- Galosys.Foundation.Agents.AI.Hosting (>= 26.8.26.1)
- Microsoft.Agents.AI.DevUI (>= 1.13.0-preview.260703.1)
- Microsoft.Agents.AI.Hosting.A2A.AspNetCore (>= 1.13.0-preview.260703.1)
- Microsoft.Agents.AI.Hosting.AGUI.AspNetCore (>= 1.13.0-preview.260703.1)
- Microsoft.Agents.AI.Hosting.OpenAI (>= 1.13.0-alpha.260703.1)
- opentelemetry (>= 1.8.1)
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 |