Files
agent-framework/dotnet
T
Roger Barreto a442ee115d .NET: AzureAI Package - Skip tool validation when UseProvidedChatClientAsIs is true (#4389)
* Skip tool validation when UseProvidedChatClientAsIs is true (#3855)

When GetAIAgentAsync is called with ChatClientAgentOptions.UseProvidedChatClientAsIs = true,
skip requireInvocableTools validation so users can handle function calls manually
via custom ChatClient middleware without needing to provide matching AIFunction tools.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Simplify requireInvocableTools expression per review feedback

UseProvidedChatClientAsIs is a non-nullable bool, so use ! operator
instead of != true for clarity.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Decouple tool matching from validation and add tool preservation test (#3855)

Always match provided AIFunctions to server-side function definitions
regardless of requireInvocableTools flag. Only throw when validation
is required and no match is found. This ensures UseProvidedChatClientAsIs
still preserves user-provided AIFunction tools instead of falling back
to the broken ResponseToolAITool wrapper.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
a442ee115d · 2026-03-02 22:12:55 +00:00
History
..
2025-11-22 04:14:15 +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