Microsoft.Agents.Hosting.AspNetCore 1.9.191-beta

Prefix Reserved
This is a prerelease version of Microsoft.Agents.Hosting.AspNetCore.
dotnet add package Microsoft.Agents.Hosting.AspNetCore --version 1.9.191-beta
                    
NuGet\Install-Package Microsoft.Agents.Hosting.AspNetCore -Version 1.9.191-beta
                    
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="Microsoft.Agents.Hosting.AspNetCore" Version="1.9.191-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.Agents.Hosting.AspNetCore" Version="1.9.191-beta" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.Agents.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 Microsoft.Agents.Hosting.AspNetCore --version 1.9.191-beta
                    
#r "nuget: Microsoft.Agents.Hosting.AspNetCore, 1.9.191-beta"
                    
#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 Microsoft.Agents.Hosting.AspNetCore@1.9.191-beta
                    
#: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=Microsoft.Agents.Hosting.AspNetCore&version=1.9.191-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.Agents.Hosting.AspNetCore&version=1.9.191-beta&prerelease
                    
Install as a Cake Tool

Microsoft.Agents.Hosting.AspNetCore

About

ASP.NET Core hosting for agents built with the Microsoft 365 Agents SDK. This package connects the SDK's agent and adapter abstractions to ASP.NET Core dependency injection, middleware, and endpoint routing so applications can receive Activity Protocol requests from Azure Bot Service and other channels.

Main APIs

  • Host setup: AddAgentDefaults(), AddAgentCore(), AddAgent<T>(), and AddAgentAuthorization() register the common ASP.NET Core services, configured connections, an agent with its CloudAdapter, and an application-selected authentication scheme.
  • Request pipeline: UseAgents() adds authentication, authorization, and header propagation middleware.
  • Endpoint mapping: MapDefaultAgentEndpoints() provides conventional root and Activity Protocol endpoints. MapAgentApplicationEndpoints(), MapAgentEndpoints(), and MapAgentProactiveEndpoints<TAgent>() support custom and proactive routing.
  • Adapters: CloudAdapter and IAgentHttpAdapter translate ASP.NET Core HTTP requests and responses to the SDK activity-processing pipeline, including invoke, expect-replies, and streaming responses.
  • Optional integrations: Host extensions register agent middleware, HTTP or Microsoft 365 attachment downloaders, background activity processing, and request-header propagation.

Authentication enforcement integrates with ASP.NET Core, but this package does not provide a concrete authentication scheme.

Custom connection configuration sections

By default, configured token providers and their routing map are read from the top-level Connections and ConnectionsMap sections. To use nested or differently named sections, register the custom paths before adding the agent:

builder
    .AddAgentCore(
        connectionsKey: "Agent:Authentication:Connections",
        mapKey: "Agent:Authentication:ConnectionsMap")
    .AddAgent<MyAgent>();

When using a custom CloudAdapter, specify the same adapter type in both calls:

builder
    .AddAgentCore<MyAdapter>(
        connectionsKey: "Agent:Authentication:Connections",
        mapKey: "Agent:Authentication:ConnectionsMap")
    .AddAgent<MyAgent, MyAdapter>();

Error handling

CloudAdapter logs unhandled exceptions with their full server-side stack traces. Its default error handler sends the exception-message chain to the customer and emits a diagnostic trace activity without a stack trace.

To replace the default handler without deriving from CloudAdapter, register an ICloudAdapterErrorHandler before the agent services:

builder.Services.AddSingleton<ICloudAdapterErrorHandler, MyErrorHandler>();
builder.AddAgent<MyAgent>();

Stack traces in diagnostic trace activities are disabled by default. To opt in while developing, add the following setting to appsettings.Development.json:

{
  "CloudAdapterOptions": {
    "EmitStackTrace": true
  }
}

EmitStackTrace does not affect server-side exception logging.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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 (15)

Showing the top 5 NuGet packages that depend on Microsoft.Agents.Hosting.AspNetCore:

Package Downloads
Microsoft.TeamsFx

This package aims to reduce the developer tasks of implementing identity and access to cloud resources down to single-line statements with "zero configuration".

Microsoft.Agents.A365.Runtime

Runtime utilities for Microsoft Agent 365 SDK, providing HttpContext-based tenant and worker ID extraction for multi-tenant agent applications.

Microsoft.Agents.Hosting.AspNetCore.A2A.Preview

Library adding A2A handling to a SDK Agent

Microsoft.Agents.A365.Tooling

Microsoft Agent 365 Tooling SDK, providing functionality to work with Agent 365 Tools.

Microsoft.Agents.A365.Observability

Common observability components for Microsoft Agent 365 SDK, providing base OpenTelemetry tracing and monitoring functionality for AI agents and tools.

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Microsoft.Agents.Hosting.AspNetCore:

Repository Stars
microsoft/copilot-camp
Hands-on labs for extending Microsoft 365 Copilot and building custom engine agents
microsoft/Agent365-Samples
Version Downloads Last Updated
1.9.191-beta 73 10/16/2026
1.9.190-beta 119 10/15/2026
1.9.185-beta 215 10/13/2026
1.9.179-beta 193 10/10/2026
1.9.172-beta 170 10/9/2026
1.9.167-beta 402 10/3/2026
1.9.69-beta 152 10/2/2026
1.9.66-beta 385 9/26/2026
1.9.64-beta 172 9/25/2026
1.9.59-beta 313 9/22/2026
1.9.50-beta 594 9/18/2026
1.9.42-beta 234 9/17/2026
1.9.40-beta 270 9/15/2026
1.9.38-beta 223 9/12/2026
1.9.35-beta 10,820 9/11/2026
1.9.28-beta 650 9/5/2026
1.9.25-beta 154 9/4/2026
1.9.15-beta 592 8/27/2026
1.9.8-beta 157 8/26/2026
1.9.3-beta 240 8/25/2026
Loading failed