Skip to content
MfC#

Microsoft Agent Framework (.NET)

The .NET agent SDK (Microsoft.Agents.AI): ChatClientAgent and providers, tools, MCP, middleware, sessions and memory, graph workflows, multi-agent orchestrations, hosting over OpenAI, A2A and AG-UI, observability, testing and evaluation.

The .NET SDK that succeeds Semantic Kernel’s agent features and AutoGen (generally available since 2 April 2026). Build C# agents with ChatClientAgent on any IChatClient, compose them in graph workflows and prebuilt orchestrations, serve them over OpenAI-compatible, A2A and AG-UI endpoints, and use Azure services through managed identity.

Install

Terminal window
dotnet add package Microsoft.Agents.AI --version 1.28.0
dotnet add package Microsoft.Agents.AI.OpenAI # AsAIAgent() for OpenAI / Azure OpenAI

Version

Microsoft.Agents.AI 1.28.0 (checked 2026-11-19) · .NET 8.0+, also .NET Standard 2.0 / .NET Framework 4.7.2

Best for

Enterprise .NET agents, Azure-native deployments, ASP.NET Core hosting, multi-agent workflows.

In sidebar order.

The Microsoft.Agents.AI.* packages release together under the core’s version number, except the durable ones; preview, alpha and release-candidate builds carry a suffix, so install them with --prerelease. Status as listed on NuGet on 2026-11-19.

PackageStatusWhat it addsCovered on
Microsoft.Agents.AI, .AbstractionsstableAIAgent, ChatClientAgent, sessions, context providers, compaction, evaluationProviders
Microsoft.Agents.AI.OpenAIstableAsAIAgent() on the OpenAI SDK’s ChatClient and ResponsesClientProviders
Microsoft.Agents.AI.AnthropicstableAsAIAgent() on AnthropicClientProviders
Microsoft.Agents.AI.GitHub.CopilotstableGitHubCopilotAgentProviders
Microsoft.Agents.AI.HarnessstableHarnessAgentComprehensive guide
Microsoft.Agents.AI.Workflows, .Workflows.GeneratorsstableGraph workflows and orchestrations; the [MessageHandler] source generatorWorkflows
Microsoft.Agents.AI.Workflows.Declarative, .Workflows.Declarative.McpstableYAML workflows; MCP servers inside themWorkflows
Microsoft.Agents.AI.Declarativerelease candidateYAML agentsFeature tour
Microsoft.Agents.AI.FoundrypreviewFoundry models and agents, FoundryAITool, Foundry memory and evaluatorsProviders
Microsoft.Agents.AI.A2ApreviewA2AAgent clientHosting
Microsoft.Agents.AI.CopilotStudiopreviewCopilotStudioAgentProviders
Microsoft.Agents.AI.McpalphaMCP tasks and MCP-served skillsMCP
Microsoft.Agents.AI.CosmosNoSqlpreviewCosmosChatHistoryProviderSessions and memory
Microsoft.Agents.AI.ValkeyalphaValkey (Redis-compatible) history and searchSessions and memory
Microsoft.Agents.AI.Tools.ShellpreviewLocal and Docker shell toolsTools
Microsoft.Agents.AI.LocalCodeAct, .HyperlightpreviewCodeAct in a local Python process or a Hyperlight micro-VMTools
Microsoft.Agents.AI.AgentHooksalphaAGENT-HOOKS policy interceptionMiddleware
Microsoft.Agents.AI.Purviewrelease candidateMicrosoft Purview DLP policiesProduction guide
Microsoft.Agents.AI.Hosting, .Hosting.AspNetCore, .Hosting.AzureStoragepreviewAddAIAgent, AddWorkflow, session stores, claims-based isolationHosting
Microsoft.Agents.AI.Hosting.OpenAIalphaOpenAI Responses, Conversations and Chat Completions endpointsHosting
Microsoft.Agents.AI.Hosting.A2A.AspNetCorepreviewA2A serverHosting
Microsoft.Agents.AI.Hosting.AGUI.AspNetCorepreviewAG-UI serverHosting
AGUI.Clientstable, from the AG-UI projectAG-UI client (AGUIChatClient); replaces Microsoft.Agents.AI.AGUI, which is no longer updatedHosting
Microsoft.Agents.AI.DevUIpreviewBrowser UI for developmentHosting
Microsoft.Agents.AI.Foundry.HostingpreviewYour agent as a Foundry hosted agentHosting
Microsoft.Agents.AI.Hosting.AzureFunctions, .DurableTaskpreview, released separatelyDurable agents and workflows; now built in the agent-framework-durable-extension repository, on their own version line, separate from the core’sHosting
Microsoft.Agents.AI.AzureAI.Persistentpreview, obsoleteThe classic Azure AI Agents service; every extension is marked [Obsolete], use Foundry agents insteadProviders

Other models (Ollama, Bedrock, Gemini and so on) plug in through any Microsoft.Extensions.AI IChatClient implementation; there are no separate Microsoft.Agents.AI.* packages for them. MCP clients and servers come from the official C# SDK, ModelContextProtocol.

using Azure.AI.OpenAI;
using Azure.Identity;
using Microsoft.Agents.AI;
using OpenAI.Chat;
var client = new AzureOpenAIClient(
new Uri(Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")!),
new DefaultAzureCredential()
);
// AsAIAgent (Microsoft.Agents.AI.OpenAI) wraps the OpenAI SDK ChatClient in a ChatClientAgent.
AIAgent agent = client
.GetChatClient("gpt-6.1-sol")
.AsAIAgent(instructions: "You are a helpful assistant.");
AgentSession session = await agent.CreateSessionAsync(); // multi-turn state
var response = await agent.RunAsync("What is 15 + 27?", session);
Console.WriteLine(response.Text);

If you already have an IChatClient (from Microsoft.Extensions.AI), construct the agent directly: new ChatClientAgent(chatClient, instructions: "..."). Earlier previews used AgentThread / GetNewThread() and CreateAIAgent(...); the GA names are AgentSession / CreateSessionAsync() and AsAIAgent(...).

Ready? Start Zero → Hero Step 1 →


DateVersionChanges
2026-10-251.26.0Expanded the .NET guide from 9 to 19 pages: new providers, tools, MCP, middleware, sessions and memory, workflows, orchestrations, hosting, observability and testing-and-evaluation pages, each compiled against 1.26.0. The comprehensive guide now summarises those topics and links to them; the feature tour and streaming-server page point to their new homes. Index rebuilt: a page map in sidebar order, Zero → Hero and topic links repointed, and a package table checked on NuGet (adds .Mcp, .Valkey, .Tools.Shell, .LocalCodeAct, .Hyperlight, .AgentHooks, .Purview, .Declarative, AGUI.Client and the separately released durable packages; marks .AzureAI.Persistent obsolete).
2026-10-251.26.0Rebuilt the C# blocks against 1.26.0: 59 of 78 build on their own and the rest fail identically against 1.25.0 because they use types from neighbouring blocks or packages outside the test project (the GitHub Copilot block was not built). Production guide: custom AgentSessionStores must now implement DeleteSessionAsync; added MapAGUIServer with a per-request agent selector. DockerShellExecutorOptions.ExtraRunArgs is now UnsafeExtraRunArgs (not used in this guide).
2026-10-251.25.0Re-compiled every C# block on the .NET and cross-language pages against 1.25.0 (75 of 77 build; the Semantic Kernel interop block builds with Microsoft.SemanticKernel 1.81.0 added; the GitHub Copilot block was not built). Noted the deprecation of the classic Persistent Agents service. Added sidebar order and root-absolute links.
2026-10-211.25.0Added HarnessAgent, Anthropic and GitHub Copilot agents, evaluation and DevUI to the comprehensive guide; rewrote the Azure RBAC, advanced and production pages (Foundry hosted agents, durable Azure Functions agents, prompt-injection defence, evaluation in CI).
2026-10-211.25.0Version sweep. Install card pins and version card now read Microsoft.Agents.AI from the site’s version data. Minimal example fixed (GetChatClient(...) returns an OpenAI SDK client, not an IChatClient — use AsAIAgent); thread API updated to AgentSession / CreateSessionAsync across the .NET pages. Comprehensive guide, recipes and feature tour rewritten against the real hosting, DI and workflow APIs; every C# block compiled against 1.25.0 and the workflow examples run against a stub chat client.
2026-09-081.1.0Consistency sweep. Version card moved 1.0.1 → 1.1.0 to match the Latest: stamps already carried by the .NET pages; those stamps now name the package (Microsoft.Agents.AI). No package installation or symbol verification performed.
2026-04-211.1.0Index redesigned with Zero → Hero + Jump-to-topic grid.
2026-04-101.1.0First minor release after GA (NuGet).
2026-04-021.0.0GA on NuGet.
2025-10-011.0.0-preview.251001.1First public preview on NuGet.

Other languages: Python, Go.