Files
Roger Barreto 1ef6d43250 Bump HostedAgents samples to AgentFramework beta.10 and MAI rc4
Update all 8 HostedAgents samples:
- Azure.AI.AgentServer.AgentFramework → 1.0.0-beta.10
- Microsoft.Agents.AI.OpenAI → 1.0.0-rc4
- Microsoft.Agents.AI/AzureAI/Workflows → 1.0.0-rc4
- Azure.AI.Projects → 2.0.0-beta.1
- Fix Workflow.AsAgent() → AsAIAgent() in FoundryMultiAgent

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1ef6d43250 · 2026-03-12 14:41:17 +00:00
History
..
2026-03-11 19:05:27 +00:00

Get Started with Microsoft Agent Framework for C# Developers

Quickstart

Basic Agent - .NET

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

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

var agent = new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential())
    .GetResponsesClient(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