VOOZH about

URL: https://www.nuget.org/packages/Azure.AI.AgentServer.Core/

⇱ NuGet Gallery | Azure.AI.AgentServer.Core 1.0.0-beta.25




👁 Image
Azure.AI.AgentServer.Core 1.0.0-beta.25

Prefix Reserved
This is a prerelease version of Azure.AI.AgentServer.Core.
dotnet add package Azure.AI.AgentServer.Core --version 1.0.0-beta.25
 
 
NuGet\Install-Package Azure.AI.AgentServer.Core -Version 1.0.0-beta.25
 
 
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="Azure.AI.AgentServer.Core" Version="1.0.0-beta.25" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Azure.AI.AgentServer.Core" Version="1.0.0-beta.25" />
 
Directory.Packages.props
<PackageReference Include="Azure.AI.AgentServer.Core" />
 
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 Azure.AI.AgentServer.Core --version 1.0.0-beta.25
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Azure.AI.AgentServer.Core, 1.0.0-beta.25"
 
 
#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 Azure.AI.AgentServer.Core@1.0.0-beta.25
 
 
#: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=Azure.AI.AgentServer.Core&version=1.0.0-beta.25&prerelease
 
Install as a Cake Addin
#tool nuget:?package=Azure.AI.AgentServer.Core&version=1.0.0-beta.25&prerelease
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Azure AI Agent Server Core library for .NET

Azure.AI.AgentServer.Core is a shared hosting foundation for Azure AI Agent Server packages. It provides a library-owned ASP.NET Core host with built-in OpenTelemetry, health checks, graceful shutdown, and multi-protocol composition — so you can go from dotnet add package to a running agent server in minutes.

Source code | Package (NuGet) | Product documentation

Getting started

Install the package

Install the library for .NET with NuGet:

dotnet add package Azure.AI.AgentServer.Core --prerelease

Prerequisites

Upgrading from a version prior to beta.21? The package has been redesigned as a lightweight hosting foundation. Protocol logic has moved to Azure.AI.AgentServer.Responses and Azure.AI.AgentServer.Invocations. See the Migration Guide for details.

Tier 1 — One-liner (recommended)

Each protocol package provides a one-line server that includes Core as a transitive dependency:

// Responses protocol — install Azure.AI.AgentServer.Responses
ResponsesServer.Run<EchoHandler>();

// Invocations protocol — install Azure.AI.AgentServer.Invocations
InvocationsServer.Run<MathHandler>();

This starts a Kestrel server on the PORT environment variable (default 8088) with OpenTelemetry, a /readiness health endpoint, x-request-id request correlation, x-platform-server version header, and inbound request logging — all configured automatically.

Tier 1 supports customization via an Action<AgentHostBuilder> callback for registering additional services, middleware, or configuration. See the protocol-specific README for details.

Tier 2 — Builder pattern

Use AgentHost.CreateBuilder() when you need to compose multiple protocols, register custom services, or customize the host:

var builder = AgentHost.CreateBuilder();

// Register protocol endpoints (protocol packages provide extension methods).
builder.RegisterProtocol("MyProtocol", endpoints =>
{
 endpoints.MapGet("/hello", () => "Hello from the agent server!");
});

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

The builder provides all the same defaults as Tier 1 (OpenTelemetry, health endpoint, request correlation, version header, logging). Access the underlying WebApplicationBuilder via builder.WebApplicationBuilder for full ASP.NET Core customization (CORS, authentication, custom middleware, etc.).

Tier 3 — Standalone (existing apps)

If you have an existing ASP.NET Core application, call AddAgentServerCore() and UseAgentServerCore() to opt in to Core middleware, then register protocol endpoints alongside your own:

var builder = WebApplication.CreateBuilder();
builder.Services.AddAgentServerCore();

var app = builder.Build();
app.UseAgentServerCore();
app.MapGet("/hello", () => "Hello!");
app.Run();

This enables request correlation (x-request-id), server version header (x-platform-server), and inbound request logging. See the protocol-specific Tier 3 samples (Responses, Invocations) for complete examples including handler registration, health probes, and OpenTelemetry setup.

Key concepts

AgentHost

The static entry point. AgentHost.CreateBuilder() returns an AgentHostBuilder for composing protocols and configuring the server.

AgentHostBuilder

Configures the underlying ASP.NET Core host with sensible defaults: Kestrel on the PORT environment variable (or 8088), OpenTelemetry traces and metrics, a /readiness health endpoint, and x-platform-server version header. Protocol packages use RegisterProtocol() to add their endpoints — each protocol registers its identity segment with the ServerVersionRegistry.

PlatformHeaders

The PlatformHeaders static class defines all HTTP header name constants used across the AgentServer platform. Using these constants avoids typos and keeps header names consistent across protocol packages.

Constant Header Direction Description
RequestId x-request-id Request ↔ Response Request correlation ID
ServerVersion x-platform-server Response Server SDK identity
SessionId x-agent-session-id Response Resolved session ID
UserIsolationKey x-agent-user-isolation-key Request Platform user partition key
ChatIsolationKey x-agent-chat-isolation-key Request Platform conversation partition key
ClientHeaderPrefix x-client- Request Pass-through client header prefix
ErrorSource x-platform-error-source Response Error origin classification
ErrorDetail x-platform-error-detail Response Diagnostic error context

Request correlation (x-request-id)

RequestIdMiddleware sets the x-request-id response header on every HTTP response. The value is resolved in priority order:

  1. OpenTelemetry trace ID (if an Activity is active)
  2. Incoming x-request-id request header (if present)
  3. New GUID (fallback)

Error source classification

All error responses (4xx/5xx) include the x-platform-error-source header to classify where the error originated:

Value Meaning Example
user Caller's input is invalid — fix the request and retry Bad JSON, missing field, unknown resource ID
platform SDK or infrastructure failure — not the caller's fault Storage unreachable, auth failure, internal timeout
upstream Developer's handler code failed Handler threw exception, protocol violation

Platform errors also include x-platform-error-detail with diagnostic context (exception type, message, stack trace). User and upstream errors omit the detail header.

FoundryEnvironment

Reads Azure AI Foundry platform variables (FOUNDRY_*, PORT, SSE_KEEPALIVE_INTERVAL) to resolve agent identity, listening port, and connection strings. Also detects OTEL_EXPORTER_OTLP_ENDPOINT and APPLICATIONINSIGHTS_CONNECTION_STRING for telemetry configuration. Useful when your agent server runs as a hosted agent in AI Foundry.

Telemetry

OpenTelemetry is configured automatically via the Microsoft.OpenTelemetry distro. The Responses and Invocations protocols use dedicated activity source names (Azure.AI.AgentServer.Responses and Azure.AI.AgentServer.Invocations) for distributed tracing. Azure Monitor export is enabled when APPLICATIONINSIGHTS_CONNECTION_STRING is set, and OTLP export is enabled when OTEL_EXPORTER_OTLP_ENDPOINT is set.

Health endpoint

A /readiness endpoint is registered by default, responding to liveness and readiness probes. It reports healthy as soon as the host finishes starting.

Examples

You can familiarise yourself with different APIs using Samples.

Troubleshooting

Common errors

  • Port already in use: The server defaults to port 8088 (or the PORT environment variable). If the port is occupied, set PORT to another value or configure Kestrel directly via the builder.
  • No protocol registered: If you use AgentHost.CreateBuilder() without calling RegisterProtocol() (or a protocol extension method), the server will start but will have no protocol endpoints mapped.

Logging

The library emits OpenTelemetry traces via the Azure.AI.AgentServer.Responses and Azure.AI.AgentServer.Invocations activity sources. Inbound request logging is enabled automatically for Tier 1 and Tier 2 setups; for Tier 3, call AddAgentServerCore() and UseAgentServerCore() to enable it. Enable ASP.NET Core logging in your application configuration to diagnose startup issues.

Next steps

  • Samples — Getting started, multi-protocol composition

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.

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

Showing the top 3 NuGet packages that depend on Azure.AI.AgentServer.Core:

Package Downloads
Azure.AI.AgentServer.AgentFramework

Package Description

Azure.AI.AgentServer.Responses

An SDK for building ASP.NET Core servers that implement the Azure AI Responses API.

Azure.AI.AgentServer.Invocations

Invocations protocol implementation for Azure AI Agent Server — provides InvocationHandler, endpoint routing, and distributed tracing.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-beta.25 291 5/25/2026
1.0.0-beta.24 13,684 5/21/2026
1.0.0-beta.23 39,144 4/23/2026
1.0.0-beta.22 7,255 4/19/2026
1.0.0-beta.21 1,838 4/15/2026
1.0.0-beta.11 23,184 3/13/2026
1.0.0-beta.10 909 3/11/2026
1.0.0-beta.9 12,899 3/4/2026
1.0.0-beta.8 13,723 2/12/2026
1.0.0-beta.7 234 2/11/2026
1.0.0-beta.6 12,892 1/23/2026
1.0.0-beta.5 31,107 12/7/2025
1.0.0-beta.4 16,329 11/11/2025
1.0.0-beta.3 301 11/11/2025
1.0.0-beta.2 289 11/11/2025
1.0.0-beta.1 345 11/9/2025