Files
agent-framework/dotnet
T
westey ad0dac3c86 .NET: [BREAKING] Add ability to mark the source of Agent request messages and use that for filtering (#3540)
* Add ability to mark the source of Agent request messages and use that for filtering

* Add support for source, in addition to source type, and add unit tests for automatic stamping

* Address PR comments.

* Add merge fixes

* Address PR comments
ad0dac3c86 ยท 2026-02-09 16:53:01 +00:00
History
..
2026-02-05 18:08:55 -08:00
2025-11-22 04:14:15 +00:00

Get Started with Microsoft Agent Framework for C# Developers

Samples

Quickstart

Basic Agent - .NET

using System;
using Azure.AI.OpenAI;
using Azure.Identity;
using Microsoft.Agents.AI;

var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")!;
var deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME")!;

var agent = new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
    .GetOpenAIResponseClient(deploymentName)
    .AsAIAgent(name: "HaikuBot", instructions: "You are an upbeat assistant that writes beautifully.");

Console.WriteLine(await agent.RunAsync("Write a haiku about Microsoft Agent Framework."));

Examples & Samples

Agent Framework Documentation