You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Get Started with Microsoft Agent Framework for C# Developers
Quickstart
Basic Agent - .NET
usingSystem.ClientModel.Primitives;usingAzure.Identity;usingMicrosoft.Agents.AI;usingOpenAI;usingOpenAI.Responses;// Use the Azure OpenAI v1 route with the OpenAI SDK (resource root + /openai/v1).varendpoint=Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")!;// e.g. https://YOUR.openai.azure.com/openai/v1/vardeploymentName=Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME")!;varagent=newOpenAIClient(newBearerTokenPolicy(newAzureCliCredential(),"https://ai.azure.com/.default"),newOpenAIClientOptions{Endpoint=newUri(endpoint)}).GetResponsesClient().AsAIAgent(model:deploymentName,name:"HaikuBot",instructions:"You are an upbeat assistant that writes beautifully.");Console.WriteLine(awaitagent.RunAsync("Write a haiku about Microsoft Agent Framework."));