Build Intelligent AI Agents
with Microsoft Agent Framework

The next generation of Semantic Kernel & AutoGen — combining simple agent abstractions with enterprise-grade features, type safety, and graph-based workflows. All in C# and .NET.

🔒 No cloud account? Run agents on your own machine with Ollama — zero cost, zero API key.

AIAgent agent = new AzureOpenAIClient(
    new Uri(Environment.GetEnvironmentVariable(
        "AZURE_OPENAI_ENDPOINT")!),
    new AzureCliCredential())
  .GetChatClient("gpt-4o-mini")
  .AsAIAgent(instructions:
      "You are a friendly assistant.");

Console.WriteLine(
    await agent.RunAsync(
        "What is the capital of France?"));

What is an Agent?

An AI agent is a software system that uses a Large Language Model (LLM) as its reasoning engine. Unlike a simple API call, an agent can autonomously plan, use tools, and carry on multi-turn conversations to complete complex tasks.

  • LLM-powered reasoning — the model decides what to do next
  • Tool use — call functions, APIs, search, or code execution
  • Multi-turn memory — maintains conversation history across turns
  • Autonomous decision-making — determines how many steps to take

💡 Rule of thumb

"If you can write a plain function to handle the task, do that instead of using an AI agent."

— Microsoft Agent Framework documentation

What is Agent Framework?

Microsoft's Agent Framework is the direct successor to both Semantic Kernel and AutoGen — built by the same teams, combining the best of both worlds.

🔗
Simple Abstractions

Create agents in minutes with fluent APIs. A single .AsAIAgent() call wraps any IChatClient into a fully featured AI agent.

🏢
Enterprise Features

Session-based state management, middleware pipeline, telemetry & observability, and type safety — production-ready out of the box.

🔀
Graph-Based Workflows

Orchestrate multiple agents with explicit control flow. Sequential, concurrent, branching, and human-in-the-loop patterns built in.

Supported Providers

Provider NuGet Package Chat Completion Responses API Function Tools
Azure OpenAIMicrosoft.Agents.AI.OpenAI
OpenAIMicrosoft.Agents.AI.OpenAI
Anthropic ClaudeMicrosoft.Agents.AI.Anthropic
🦙 Ollama Local · FreeOllamaSharp
🖥️ LM Studio Local · FreeOpenAI (custom endpoint)
Azure AI FoundryMicrosoft.Agents.AI.OpenAI

Agents vs Workflows

Choose the right tool for the job.

Use an Agent when…Use a Workflow when…
The task is open-ended or conversationalThe process has well-defined steps
You need autonomous tool use and planningYou need explicit control over execution order
A single LLM call (possibly with tools) sufficesMultiple agents or functions must coordinate
The number of steps isn't known upfrontCheckpointing & human-in-the-loop are required
🔒 No API Key Required

Run Agents on Your Own Machine

You don't need a cloud account or an API key to start building with Agent Framework. Install Ollama locally, pull any open-source model, and your agents run entirely on your hardware — privately, for free, forever.

  • ✅  Zero cost — no subscription, no pay-per-token
  • ✅  Full privacy — data never leaves your machine
  • ✅  Same API — identical code works with any provider
  • ✅  Great models — Llama 3.2, Qwen 2.5, Phi-3, Mistral & more

Quickstart — 3 commands

# 1. Install Ollama (https://ollama.com)
ollama pull llama3.2
# 2. Add the NuGet packages
dotnet add package Microsoft.Agents.AI --prerelease
dotnet add package OllamaSharp
# 3. Run your agent
dotnet run
using Microsoft.Agents.AI;
using OllamaSharp;

AIAgent agent = new OllamaApiClient(
        new Uri("http://localhost:11434"), "llama3.2")
    .AsAIAgent(
        instructions: "You are a helpful assistant.",
        name: "LocalAgent");

// Identical RunAsync() API — no cloud needed!
Console.WriteLine(await agent.RunAsync(
    "Explain quantum entanglement simply."));

Get Started in Minutes

Install the NuGet packages, create an agent, and run it. That's all it takes to build your first AI-powered agent in .NET.

Full Tutorial →

1 — Install packages

dotnet add package Microsoft.Agents.AI.OpenAI --prerelease
dotnet add package Azure.AI.OpenAI --prerelease
dotnet add package Azure.Identity

2 — Create and run your agent

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

AIAgent agent = new AzureOpenAIClient(
        new Uri(Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")!),
        new AzureCliCredential())
    .GetChatClient("gpt-4o-mini")
    .AsAIAgent(instructions: "You are a friendly assistant.");

Console.WriteLine(await agent.RunAsync("What is the largest city in France?"));