Files
agent-framework/dotnet
T
Copilot e8902c0d11 .NET: Improve unit test coverage for Microsoft.Agents.AI.Abstractions (#3381)
* Initial plan

* Add unit tests to improve coverage for Microsoft.Agents.AI.Abstractions

Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>

* Fix file encoding and naming rule violation in new test files

Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>

* Remove ChatMessageStoreExtensionsTests.cs to avoid duplication with Wesley's work

Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>

* Fix AgentThread to AgentSession rename in unit tests

Update MockAgentWithName in AIAgentTests.cs and DelegatingAIAgentTests.cs
to use the renamed AgentSession class and corresponding methods:
- AgentThread -> AgentSession
- GetNewThreadAsync -> GetNewSessionAsync
- DeserializeThreadAsync -> DeserializeSessionAsync
- thread parameter -> session parameter

* Fix: Rename GetNewSessionAsync to CreateSessionAsync to match API changes

* Fix: Add SerializeSession override and remove async from DeserializeSessionAsync

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
e8902c0d11 ยท 2026-02-04 17:43:31 +00:00
History
..
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