{"id":58353,"date":"2025-10-01T07:05:00","date_gmt":"2025-10-01T14:05:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=58353"},"modified":"2025-11-04T10:02:05","modified_gmt":"2025-11-04T18:02:05","slug":"introducing-microsoft-agent-framework-preview","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/introducing-microsoft-agent-framework-preview\/","title":{"rendered":"Introducing Microsoft Agent Framework (Preview): Making AI Agents Simple for Every Developer"},"content":{"rendered":"<p>Building AI agents shouldn&#8217;t be rocket science. Yet many developers find themselves wrestling with complex orchestration logic, struggling to connect multiple AI models, or spending weeks building hosting infrastructure just to get a simple agent into production.<\/p>\n<p>What if building an AI agent could be as straightforward as creating a web API or console application?<\/p>\n<h2>Agents and Workflows<\/h2>\n<p>Before we dive deeper, let\u2019s define the two core building blocks of agent systems: <strong>agents<\/strong> and <strong>workflows<\/strong>. We&#8217;ll start by looking at their core components and how they relate to one another<\/p>\n<h3>Agents<\/h3>\n<p>Across the web, you\u2019ll find many definitions of agents. Some conflicting, some overlapping.<\/p>\n<p>For this post, we\u2019ll keep it simple:<\/p>\n<p><strong>Agents are systems that combine reasoning, context, and tools to pursue objectives.<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2025\/10\/agent.png\" alt=\"Diagram showing an AI agent with reasoning, tool usage, and context inputs feeding its objective completion\" \/><\/p>\n<p>Let&#8217;s break down each of those components:<\/p>\n<ul>\n<li><strong>Reasoning and decision-making<\/strong>: Agents need reasoning capabilities to decide which actions to take toward their objectives. Today, this is often powered by large language models (LLMs). However, other techniques such as search algorithms, planning systems, or classical AI approaches can also be used.<\/li>\n<li><strong>Context awareness<\/strong>: Context is the external data or state that informs decision-making. Because models don\u2019t have built-in access to real-time or system-specific information, additional inputs like conversation history, knowledge bases, or enterprise data are required to make informed decisions.<\/li>\n<li><strong>Tool usage<\/strong>: Tools are discrete, callable capabilities such as APIs, Model Context Protocol (MCP) tools, code execution, or data queries. They typically extend what a system can do but do not make decisions themselves. For example, a weather API provides data, but it does not decide how that data is used. Tools can be used to carry out actions or to gather additional context that informs future decisions.<\/li>\n<\/ul>\n<p>Agents bring these components together to maintain awareness, make decisions, and act dynamically in pursuit of their goals.<\/p>\n<h3>Workflows<\/h3>\n<p>As objectives grow in complexity, they need to be broken down into manageable steps. That\u2019s where workflows come in.<\/p>\n<p><strong>Workflows structure complex objectives into sequences of steps, coordinating tasks across people or systems to reach a goal efficiently.<\/strong><\/p>\n<p>Imagine you&#8217;re launching a new feature on your business website. If it&#8217;s a simple update, you might go from idea to production in a few hours. But for more complex initiatives, the process might include:<\/p>\n<ul>\n<li>Requirement gathering<\/li>\n<li>Design and architecture<\/li>\n<li>Implementation<\/li>\n<li>Testing<\/li>\n<li>Deployment<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2025\/10\/workflow.png\" alt=\"Diagram illustrating a multi-step software delivery workflow with iterative feedback loops between phases\" \/><\/p>\n<p>A few important observations:<\/p>\n<ul>\n<li>Each step may contain subtasks.<\/li>\n<li>Different specialists may own different phases.<\/li>\n<li>Progress isn\u2019t always linear. Bugs found during testing may send you back to implementation.<\/li>\n<\/ul>\n<p>Success relies on planning, orchestration, and communication across stakeholders.<\/p>\n<h3>Agents + Workflows<\/h3>\n<p>While workflows can function purely as predetermined sequences, integrating agents adds dynamic decision-making and adaptability, enabling more intelligent and autonomous process management.<\/p>\n<p>Agents, workflows, and their underlying components are all highly composable:<\/p>\n<ul>\n<li>Agents can call multiple tools<\/li>\n<li>Tools may encapsulate agent-like behaviors in narrow scopes<\/li>\n<li>Workflows can sequence agents, tools, and other workflows<\/li>\n<li>Agents themselves may internally run workflows<\/li>\n<\/ul>\n<p>Together, this layered architecture supports building flexible, intelligent, and scalable systems.<\/p>\n<h2>Meet Microsoft Agent Framework<\/h2>\n<p>Microsoft Agent Framework is a comprehensive set of .NET libraries that reduces the complexity of agent development. Whether you&#8217;re building a simple chatbot or orchestrating multiple AI agents in complex workflows, Microsoft Agent Framework provides the tools you need to:<\/p>\n<ul>\n<li><strong>Build<\/strong> agents with minimal boilerplate code<\/li>\n<li><strong>Orchestrate<\/strong> multi-agent workflows with ease<\/li>\n<li><strong>Host<\/strong> and deploy agents using familiar .NET patterns<\/li>\n<li><strong>Monitor<\/strong> and observe agent behavior in production<\/li>\n<\/ul>\n<p>For more details, see the <a href=\"https:\/\/aka.ms\/AgentFramework\/PuPr\">Introducing Microsoft Agent Framework post in the Foundry blog<\/a>.<\/p>\n<p><iframe width=\"800\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/yOBcPuLLmuY?si=wN5rOwPTJcrz0xxn\" allowfullscreen><\/iframe><\/p>\n<h3>Built on Proven Foundations<\/h3>\n<p>Microsoft Agent Framework leverages established technologies to simplify agent development for .NET developers:<\/p>\n<ul>\n<li><strong>Semantic Kernel<\/strong> &#8211; Provides robust orchestration<\/li>\n<li><strong>AutoGen<\/strong> &#8211; Enables advanced multi-agent collaboration and cutting-edge research-driven techniques<\/li>\n<li><strong>Microsoft.Extensions.AI<\/strong> &#8211; Delivers standardized AI building blocks for .NET.<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2025\/10\/agent-framework-foundations.png\" alt=\"Diagram showing Agent Framework built atop Semantic Kernel, AutoGen, and Microsoft.Extensions.AI foundational libraries\" \/><\/p>\n<p>By combining these technologies, Agent Framework offers reliability, flexibility, and a developer-friendly API. This allows you to build and deploy powerful AI agents quickly and efficiently.<\/p>\n<h2>Start Simple: Build Your First Agent in Minutes<\/h2>\n<p>Getting started with Microsoft Agent Framework is simple. In the following example, you&#8217;ll build a creative writing agent that generates engaging short stories.<\/p>\n<p>The fastest way to try it out is to open the <a href=\"https:\/\/aka.ms\/dotnet\/agent-framework\/helloworld\">Hello World Agents sample<\/a> in GitHub Codespaces:<\/p>\n<p><a href=\"https:\/\/codespaces.new\/luisquintanilla\/hello-world-agents?devcontainer_path=.devcontainer.json\"><img decoding=\"async\" src=\"https:\/\/github.com\/codespaces\/badge.svg\" alt=\"Open in GitHub Codespaces\" \/><\/a><\/p>\n<p>If you prefer, you can follow the step-by-step instructions below to set up the project on your own machine.<\/p>\n<h3>Step 0: Configure prerequisites<\/h3>\n<p>To get started, you&#8217;ll need the following:<\/p>\n<ul>\n<li><a href=\"https:\/\/dotnet.microsoft.com\/download\">.NET 9 SDK or greater<\/a><\/li>\n<li>A GitHub Personal Access Token (PAT) with <code>models<\/code> scope. You can create one in you can create in your <a href=\"https:\/\/github.com\/settings\/tokens\">GitHub settings<\/a>. For more details, see the <a href=\"https:\/\/docs.github.com\/en\/authentication\/keeping-your-account-and-data-secure\/managing-your-personal-access-tokens?source=post_page-----3474aac2c6f2---------------------------------------#creating-a-personal-access-token-classic\">GitHub documentation<\/a><\/li>\n<\/ul>\n<p>This project can use GitHub-hosted models so you&#8217;ll need to provide the GitHub Personal Access Token (PAT) to your application using the <code>GITHUB_TOKEN<\/code> environment variable.<\/p>\n<h4>Windows<\/h4>\n<pre><code class=\"language-powershell\">setx GITHUB_TOKEN \"YOUR-GITHUB-TOKEN\"\r\n# Restart your shell to pick up the value<\/code><\/pre>\n<h4>Linux \/ Mac<\/h4>\n<pre><code class=\"language-bash\">export GITHUB_TOKEN=\"YOUR-GITHUB-TOKEN\"<\/code><\/pre>\n<h3>Step 1: Set Up Your Project<\/h3>\n<ol>\n<li>Create a new C# console application and install the Agent Framework packages:\n<pre><code class=\"language-bash\">dotnet new console -o HelloWorldAgents\r\ncd HelloWorldAgents\r\ndotnet add package Microsoft.Agents.AI --prerelease<\/code><\/pre>\n<\/li>\n<li>You&#8217;ll also need to install the following packages to use the models from GitHub models.\n<pre><code class=\"language-bash\">dotnet add package OpenAI\r\ndotnet add package Microsoft.Extensions.AI.OpenAI --prerelease\r\ndotnet add package Microsoft.Extensions.AI<\/code><\/pre>\n<\/li>\n<\/ol>\n<h3>Step 2: Write Your Agent<\/h3>\n<ol>\n<li>Add this code to your <em>Program.cs<\/em> file to create a story-writing agent:\n<pre><code class=\"language-csharp\">using Microsoft.Extensions.AI;\r\nusing Microsoft.Agents.AI;\r\nusing OpenAI;\r\nusing OpenAI.Chat;\r\nusing System.ClientModel;\r\n\r\nIChatClient chatClient =\r\n    new ChatClient(\r\n            \"gpt-4o-mini\",\r\n            new ApiKeyCredential(Environment.GetEnvironmentVariable(\"GITHUB_TOKEN\")!),\r\n            new OpenAIClientOptions { Endpoint = new Uri(\"https:\/\/models.github.ai\/inference\") })\r\n        .AsIChatClient();\r\n\r\nAIAgent writer = new ChatClientAgent(\r\n    chatClient,\r\n    new ChatClientAgentOptions\r\n    {\r\n        Name = \"Writer\",\r\n        Instructions = \"Write stories that are engaging and creative.\"\r\n    });\r\n\r\nAgentRunResponse response = await writer.RunAsync(\"Write a short story about a haunted house.\");\r\n\r\nConsole.WriteLine(response.Text);<\/code><\/pre>\n<\/li>\n<li>Run your application<\/li>\n<\/ol>\n<p>That&#8217;s it! In just a few lines of code, you have a fully functional AI agent.<\/p>\n<h3>The Power of Abstraction<\/h3>\n<p>Microsoft Agent Framework is designed around powerful abstractions that simplify agent development.<\/p>\n<p>At its core is the <code>AIAgent<\/code> abstraction, which provides a unified interface for building agents. The flexibility to use any compatible AI model provider comes from Microsoft.Extensions.AI, which standardizes model access through the <code>IChatClient<\/code> interface.<\/p>\n<p>The <code>ChatClientAgent<\/code> implementation of <code>AIAgent<\/code> accepts any <code>IChatClient<\/code>, allowing you to easily choose between providers such as:<\/p>\n<ul>\n<li>OpenAI<\/li>\n<li>Azure OpenAI<\/li>\n<li>Foundry Local<\/li>\n<li>Ollama<\/li>\n<li>GitHub Models<\/li>\n<li>Many others<\/li>\n<\/ul>\n<p>This means you can swap providers or integrate new ones without changing your agent code. The same <code>AIAgent<\/code> interface works seamlessly with:<\/p>\n<ul>\n<li><strong>Azure Foundry Agents<\/strong><\/li>\n<li><strong>OpenAI Assistants<\/strong><\/li>\n<li><strong>Copilot Studio<\/strong><\/li>\n<li>Many others<\/li>\n<\/ul>\n<p>If you&#8217;ve built agents using different SDKs or platforms, using Microsoft Agent Framework is straightforward. You get a consistent developer experience and can leverage orchestration, hosting, and monitoring features.<\/p>\n<h2>Scale Up: Orchestrate Multiple Agents<\/h2>\n<p>Single agents are powerful, but real-world scenarios often require multiple specialized agents working together. Maybe your writing agent creates great content, but you also need an editor to polish it, or a fact-checker to verify details.<\/p>\n<p>Agent Framework makes multi-agent orchestration as simple as connecting building blocks.<\/p>\n<h3>Adding Specialized Agents<\/h3>\n<p>Let&#8217;s enhance our story example by adding an editor agent to review and improve the writer&#8217;s output:<\/p>\n<pre><code class=\"language-csharp\">\/\/ Create a specialized editor agent\r\nAIAgent editor = new ChatClientAgent(\r\n    chatClient,\r\n    new ChatClientAgentOptions\r\n    {\r\n        Name = \"Editor\",\r\n        Instructions = \"Make the story more engaging, fix grammar, and enhance the plot.\"\r\n    });<\/code><\/pre>\n<h3>Building Workflows<\/h3>\n<p>Now comes the magic &#8211; connecting these agents in a workflow.<\/p>\n<ol>\n<li>Install the Microsoft.Agents.Workflows NuGet package:\n<pre><code class=\"language-bash\">dotnet add package Microsoft.Agents.AI.Workflows --prerelease<\/code><\/pre>\n<\/li>\n<li>Create a workflow to orchestrates your agents:\n<pre><code class=\"language-csharp\">\/\/ Create a workflow that connects writer to editor\r\nWorkflow workflow =\r\n    AgentWorkflowBuilder\r\n        .BuildSequential(writer, editor);\r\n\r\nAIAgent workflowAgent = await workflow.AsAgentAsync();\r\n\r\nAgentRunResponse workflowResponse =\r\n    await workflowAgent.RunAsync(\"Write a short story about a haunted house.\");\r\n\r\nConsole.WriteLine(workflowResponse.Text);<\/code><\/pre>\n<\/li>\n<\/ol>\n<h3>The Result<\/h3>\n<p>Now when you run your application, the writer creates the initial story, and the editor automatically reviews and improves it. The entire workflow appears to the outside world as a single, more capable agent.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2025\/10\/writer-editor-workflow.png\" alt=\"Workflow diagram: writer agent creates a story, editor agent reviews and improves it in sequence\" \/><\/p>\n<p>This pattern scales to any complexity:<\/p>\n<ul>\n<li><strong>Research workflows<\/strong>: Researcher \u2192 Fact-checker \u2192 Summarizer<\/li>\n<li><strong>Content pipelines<\/strong>: Writer \u2192 Editor \u2192 SEO Optimizer \u2192 Publisher<\/li>\n<li><strong>Customer service<\/strong>: Intent Triage \u2192 Customer Specialist Agent \u2192 Quality Reviewer<\/li>\n<\/ul>\n<p>The key takeaway here is, complex agent systems are compositions of simple, focused agents.<\/p>\n<h3>All Types of Workflows<\/h3>\n<p>The example above uses a <strong>sequential workflow<\/strong>, where agents process tasks one after another, each building on the previous agent&#8217;s output. However, Microsoft Agent Framework supports a variety of workflow patterns to fit different requirements:<\/p>\n<ul>\n<li><strong>Sequential<\/strong>: Agents execute in order, passing results along the chain.<\/li>\n<li><strong>Concurrent<\/strong>: Multiple agents work in parallel, addressing different aspects of a task simultaneously.<\/li>\n<li><strong>Handoff<\/strong>: Responsibility shifts between agents based on context or outcomes.<\/li>\n<li><strong>GroupChat<\/strong>: Agents collaborate in a shared, real-time conversational space.<\/li>\n<\/ul>\n<p>These flexible workflow types enable orchestration for everything from simple pipelines to dynamic, multi-agent collaboration.<\/p>\n<h2>Empower Agents with Tools<\/h2>\n<p>Microsoft Agent Framework makes it incredibly easy to give your agents access to external functions, APIs, and services so your agents can take action.<\/p>\n<h3>Creating Agent Tools<\/h3>\n<p>Let&#8217;s enhance our writing agent with some useful tools. In our story example, we might want agents that can do the following:<\/p>\n<pre><code class=\"language-csharp\">[Description(\"Gets the author of the story.\")]\r\nstring GetAuthor() =&gt; \"Jack Torrance\";\r\n\r\n[Description(\"Formats the story for display.\")]\r\nstring FormatStory(string title, string author, string story) =&gt;\r\n    $\"Title: {title}\\nAuthor: {author}\\n\\n{story}\";<\/code><\/pre>\n<h3>Connecting Tools to Agents<\/h3>\n<p>Adding these tools to your agent is straightforward. Here&#8217;s a modified version of our writer agent configured to use the tools defined earlier.<\/p>\n<pre><code class=\"language-csharp\">AIAgent writer = new ChatClientAgent(\r\n    chatClient,\r\n    new ChatClientAgentOptions\r\n    {\r\n        Name = \"Writer\",\r\n        Instructions = \"Write stories that are engaging and creative.\",\r\n        ChatOptions = new ChatOptions\r\n        {\r\n            Tools = [\r\n                AIFunctionFactory.Create(GetAuthor),\r\n                AIFunctionFactory.Create(FormatStory)\r\n            ],\r\n        }\r\n    });<\/code><\/pre>\n<p>Running the application again would result in a formatted story per the template you provided in <code>FormatStory<\/code>.<\/p>\n<pre><code class=\"language-text\">**Title: The Haunting of Blackwood Manor**\r\n**Author: Jack Torrance**\r\n\r\nOn the outskirts of a quaint village, a grand but crumbling mansion, known as Blackwood Manor, loomed against the twilight sky. Locals spoke in hushed tones about the house, claiming it was haunted by the spirits of its former inhabitants, who had mysteriously vanished decades ago. Tales of flickering lanterns, echoing whispers, and the ghostly figure of a woman in white gliding through the halls filled the village\u2019s atmosphere with a sense of dread\r\n\/\/...<\/code><\/pre>\n<h3>Beyond Simple Functions<\/h3>\n<p>Because Microsoft Agent Framework builds on Microsoft.Extensions.AI, your agents can use more robust tools including:<\/p>\n<ul>\n<li><strong>Model Context Protocol (MCP) servers<\/strong> &#8211; Connect to external services like databases, APIs, and third-party tools<\/li>\n<li><strong>Hosted tools<\/strong> &#8211; Access server-side tools like Code Interpreter, Bing Grounding, and many more<\/li>\n<\/ul>\n<p>For example, you could connect to an MCP server that provides database access, web search, or even hardware control. Learn more about building MCP integrations in our <a href=\"https:\/\/learn.microsoft.com\/dotnet\/ai\/quickstarts\/build-mcp-client\">MCP client quickstart<\/a>.<\/p>\n<h2>Deploy with Confidence: Hosting Made Simple<\/h2>\n<p>Getting agents into production shouldn\u2019t mean learning a new deployment model. Microsoft Agent Framework integrates seamlessly with the .NET hosting patterns you already use.<\/p>\n<h3>Minimal Web API Integration<\/h3>\n<p>Using your agent in a REST API is a few lines of code.<\/p>\n<p>The code sample below makes use of the <a href=\"https:\/\/learn.microsoft.com\/dotnet\/aspire\/azureai\/azureai-openai-integration?tabs=dotnet-cli#client-integration\">Aspire OpenAI client integration<\/a> with GitHub Models.<\/p>\n<ol>\n<li>Install the package\n<pre><code class=\"language-csharp\">dotnet add package Aspire.OpenAI --prerelease<\/code><\/pre>\n<\/li>\n<li>Configure your connection string in your Web API project user secrets.\n<pre><code class=\"language-bash\">dotnet user-secrets init\r\ndotnet user-secrets set ConnectionStrings:chat \"Endpoint=https:\/\/models.github.ai\/inference;Key=YOUR-GITHUB-TOKEN\"<\/code><\/pre>\n<p>Alternatively, you can use the appsettings as shown on the <a href=\"https:\/\/learn.microsoft.com\/dotnet\/aspire\/openai\/openai-integration?tabs=dotnet-cli#configuration\">Aspire OpenAI client integration documentation<\/a>.<\/li>\n<li>Once configured, in an ASP.NET Minimal Web API, register your <code>IChatClient<\/code>:\n<pre><code class=\"language-csharp\">builder.AddOpenAIClient(\"chat\")\r\n    .AddChatClient(Environment.GetEnvironmentVariable(\"MODEL_NAME\") ?? \"gpt-4o-mini\");<\/code><\/pre>\n<\/li>\n<li>Install the <strong><a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.Agents.AI.Hosting\/\">Microsoft.Agents.AI.Hosting<\/a><\/strong> NuGet package\n<pre><code class=\"language-bash\">dotnet add package Microsoft.Agents.AI.Hosting --prerelease<\/code><\/pre>\n<\/li>\n<li>Register your agents\n<pre><code class=\"language-csharp\">builder.AddAIAgent(\"Writer\", (sp, key) =&gt;\r\n{\r\n    var chatClient = sp.GetRequiredService&lt;IChatClient&gt;();\r\n\r\n    return new ChatClientAgent(\r\n        chatClient,\r\n        name: key,\r\n        instructions:\r\n            \"\"\"\r\n            You are a creative writing assistant who crafts vivid, \r\n            well-structured stories with compelling characters based on user prompts, \r\n            and formats them after writing.\r\n            \"\"\",\r\n        tools: [\r\n            AIFunctionFactory.Create(GetAuthor),\r\n            AIFunctionFactory.Create(FormatStory)\r\n        ]\r\n    );\r\n});\r\n\r\nbuilder.AddAIAgent(\r\n    name: \"Editor\",\r\n    instructions:\r\n        \"\"\"\r\n        You are an editor who improves a writer\u2019s draft by providing 4\u20138 concise recommendations and \r\n        a fully revised Markdown document, focusing on clarity, coherence, accuracy, and alignment.\r\n        \"\"\");<\/code><\/pre>\n<\/li>\n<li>Once registered, your agents are available anywhere in your app:\n<pre><code class=\"language-csharp\">app.MapGet(\"\/agent\/chat\", async (\r\n    [FromKeyedServices(\"Writer\")] AIAgent writer,\r\n    [FromKeyedServices(\"Editor\")] AIAgent editor,\r\n    HttpContext context,\r\n    string prompt) =&gt;\r\n{\r\n    Workflow workflow =\r\n        AgentWorkflowBuilder\r\n            .CreateGroupChatBuilderWith(agents =&gt;\r\n                new AgentWorkflowBuilder.RoundRobinGroupChatManager(agents)\r\n                {\r\n                    MaximumIterationCount = 2\r\n                })\r\n            .AddParticipants(writer, editor)\r\n            .Build();\r\n\r\n    AIAgent workflowAgent = await workflow.AsAgentAsync();\r\n\r\n    AgentRunResponse response = await workflowAgent.RunAsync(prompt);\r\n    return Results.Ok(response);\r\n});<\/code><\/pre>\n<\/li>\n<\/ol>\n<h3>Production-Ready Features<\/h3>\n<p>Microsoft Agent Framework hosting includes everything you need for production:<\/p>\n<ul>\n<li><strong>Configuration<\/strong> &#8211; Manage agent settings through standard .NET configuration<\/li>\n<li><strong>Dependency injection<\/strong> &#8211; Integrate with your existing DI containers and practices<\/li>\n<li><strong>Middleware support<\/strong> &#8211; Add authentication, rate limiting, or custom logic<\/li>\n<\/ul>\n<h3>Deploy<\/h3>\n<p>Microsoft Agent Framework doesn\u2019t reinvent deployment. If you know how to ship a .NET app, you already know how to ship agents.<\/p>\n<p>No new tooling. No special hosting model. Just add agents and deploy wherever .NET runs.<\/p>\n<h2>Observe and Improve: Built-in Monitoring<\/h2>\n<p>Production agents need observability. Microsoft Agent Framework provides comprehensive monitoring that integrates with your existing observability stack.<\/p>\n<h3>OpenTelemetry Integration<\/h3>\n<p>Enable detailed telemetry with a single line:<\/p>\n<pre><code class=\"language-csharp\">\/\/ Enhanced telemetry for all your agents\r\nwriter.WithOpenTelemetry();\r\neditor.WithOpenTelemetry();<\/code><\/pre>\n<p>This captures:<\/p>\n<ul>\n<li><strong>Conversation flows<\/strong> &#8211; Visualize how messages move between agents<\/li>\n<li><strong>Model usage<\/strong> &#8211; Track token consumption, model selection, and costs<\/li>\n<li><strong>Performance metrics<\/strong> &#8211; Monitor response times and throughput<\/li>\n<li><strong>Error tracking<\/strong> &#8211; Identify and debug issues quickly<\/li>\n<\/ul>\n<h3>Rich Dashboards<\/h3>\n<p>When connected to your existing observability platforms like:<\/p>\n<ul>\n<li><strong>Aspire<\/strong><\/li>\n<li><strong>Azure Monitor<\/strong><\/li>\n<li><strong>Grafana<\/strong><\/li>\n<li>Many others<\/li>\n<\/ul>\n<p>You get detailed insights into agent behavior, helping you optimize performance and identify issues before they affect users.<\/p>\n<h3>OpenTelemetry with Aspire<\/h3>\n<p>To send agent telemetry to the Aspire dashboard, enable OpenTelemetry and allow sensitive data for richer insights.<\/p>\n<p>Set EnableSensitiveTelemetryData to true when configuring your client:<\/p>\n<pre><code class=\"language-csharp\">builder\r\n    .AddAzureChatCompletionsClient(\"chat\", settings =&gt;\r\n    {\r\n        settings.EnableSensitiveTelemetryData = true;\r\n    })\r\n    .AddChatClient(Environment.GetEnvironmentVariable(\"MODEL_NAME\")!);<\/code><\/pre>\n<p>Then, configure Aspire to recognize telemetry sources:<\/p>\n<pre><code class=\"language-csharp\">public static TBuilder ConfigureOpenTelemetry&lt;TBuilder&gt;(this TBuilder builder) where TBuilder : IHostApplicationBuilder\r\n{\r\n    builder.Logging.AddOpenTelemetry(logging =&gt;\r\n    {\r\n      \/\/...\r\n    })\r\n    .AddTraceSource(\"Experimental.Microsoft.Extensions.AI.*\");\r\n\r\n    builder.Services.AddOpenTelemetry()\r\n        .WithMetrics(metrics =&gt;\r\n        {\r\n            metrics.AddAspNetCoreInstrumentation()\r\n                .AddHttpClientInstrumentation()\r\n                .AddRuntimeInstrumentation()\r\n                .AddMeter(\"Experimental.Microsoft.Extensions.AI.*\");\r\n        })\r\n        .WithTracing(tracing =&gt;\r\n        {\r\n            tracing.AddSource(builder.Environment.ApplicationName)\r\n                .AddSource(\"Experimental.Microsoft.Extensions.AI.*\")\r\n                .AddAspNetCoreInstrumentation()\r\n                .AddHttpClientInstrumentation();\r\n        });\r\n        \/\/...\r\n}<\/code><\/pre>\n<p>With this setup, Aspire dashboards show detailed telemetry including conversation flows, model usage, performance metrics, and error tracking.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2025\/10\/aspire-telemetry-dashboard.png\" alt=\"Screenshot of .NET Aspire dashboard displaying Agent Framework telemetry traces, metrics, and agent interactions\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2025\/10\/aspire-telemetry-dashboard-detail.png\" alt=\"Screenshot showing detailed telemetry panel for a single LLM request including latency, tokens, and model info\" \/><\/p>\n<h2>Ensure Quality: Evaluation and Testing<\/h2>\n<p>Trust in AI systems comes from rigorous evaluation. Microsoft Agent Framework can easily integrate with Microsoft.Extensions.AI.Evaluations to help you build reliable, trustworthy agent systems.<\/p>\n<p>This enables:<\/p>\n<ul>\n<li><strong>Automated testing<\/strong> &#8211; Run evaluation suites as part of your CI\/CD pipeline<\/li>\n<li><strong>Quality metrics<\/strong> &#8211; Measure relevance, coherence, and safety<\/li>\n<li><strong>Regression detection<\/strong> &#8211; Catch quality degradation before deployment<\/li>\n<li><strong>A\/B testing<\/strong> &#8211; Compare different configurations<\/li>\n<\/ul>\n<p>See how to <a href=\"https:\/\/learn.microsoft.com\/dotnet\/ai\/evaluation\/libraries\">get started with evaluations using Microsoft.Extensions.AI.Evaluations<\/a>.<\/p>\n<h2>Start Building Agents Today<\/h2>\n<p>Microsoft Agent Framework transforms agent development from a complex, specialized skill into something every .NET developer can master. Whether you&#8217;re building a chatbot or orchestrating multiple AI agents in complex workflows, Microsoft Agent Framework provides a clear path forward.<\/p>\n<h3>Key Takeaways<\/h3>\n<ul>\n<li><strong>Simple by Design<\/strong>: Get started with just a few lines of code. Create your first agent in minutes, not days.<\/li>\n<li><strong>Scales with You<\/strong>: Start with a single agent, then easily add workflows, tools, hosting, and monitoring as your needs grow.<\/li>\n<li><strong>Built on Proven Technology<\/strong>: Microsoft Agent Framework brings together the best from AutoGen and Semantic Kernel. It builds on Microsoft.Extensions.AI, a unified foundation for modern AI development, to deliver a robust and cohesive experience for .NET developers.<\/li>\n<li><strong>Production Ready<\/strong>: Deploy using familiar .NET patterns with built-in observability, evaluation, and hosting capabilities.<\/li>\n<\/ul>\n<h3>What&#8217;s Next?<\/h3>\n<p>Ready to start building?<\/p>\n<p>Run the <a href=\"https:\/\/aka.ms\/dotnet\/agent-framework\/helloworld\">Hello World agent sample<\/a>.<\/p>\n<p>Then, head over to the <a href=\"https:\/\/aka.ms\/dotnet\/agent-framework\/docs\">Microsoft Agent Framework documentation<\/a> to continue learning.<\/p>\n<p>The future of software development includes AI agents as first-class components in modern software development. Microsoft Agent Framework ensures that future is accessible to every .NET developer.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft Agent Framework (Preview) unifies agent creation, orchestration, tooling, hosting, and observability so any .NET developer can ship production AI agents faster.<\/p>\n","protected":false},"author":26108,"featured_media":58446,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685,7781],"tags":[8074,568,8075],"class_list":["post-58353","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-ai","tag-agents","tag-ai","tag-microsoftagentframework"],"acf":[],"blog_post_summary":"<p>Microsoft Agent Framework (Preview) unifies agent creation, orchestration, tooling, hosting, and observability so any .NET developer can ship production AI agents faster.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/58353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/26108"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=58353"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/58353\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58446"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=58353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=58353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=58353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}