loading experience

AI & agents

Microsoft Agent Framework: agents and workflows in .NET

The open-source framework that combines the experience of Semantic Kernel and AutoGen to build agents and multi-agent systems.

Microsoft Agent Framework: agents and workflows in .NET

The Microsoft Agent Framework is Microsoft's open-source framework, for .NET and Python, dedicated to AI agents. It comes from the merger of two projects: Semantic Kernel, solid and designed for enterprises, and AutoGen, the research lab for multi-agent systems.

Agents build on the common Microsoft.Extensions.AI abstractions.
Agents build on the common Microsoft.Extensions.AI abstractions.

Key concepts

  • Agent: a language model with instructions, a name and tools, built on top of the IChatClient abstraction.
  • Thread: the conversation and its state, which can be stored and resumed.
  • Tools: C# functions and MCP servers the agent can use.
  • Workflows: graphs connecting agents and code steps, with sequential, concurrent, handoff and group chat patterns.

A first agent

using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;

IChatClient chatClient = CreateChatClient(); // Azure OpenAI, OpenAI, a local model...

AIAgent assistant = chatClient.CreateAIAgent(
    name: "OrderAssistant",
    instructions: "Answer questions about order status. Use only data returned by the tools.",
    tools: [AIFunctionFactory.Create(OrderStatus)]);

AgentThread thread = assistant.GetNewThread();
Console.WriteLine(await assistant.RunAsync("Where is order 4521?", thread));

[Description("Returns the status of an order given its number")]
static string OrderStatus(int number) => number == 4521 ? "shipped yesterday" : "not found";

The framework's APIs are still evolving quickly: before adopting them in production, check the documentation for the version you use.

What it adds compared to hand-written code

  • Management of conversation state and memory.
  • Workflows with checkpoints, resumption after a failure and human intervention at critical steps.
  • Integration with the Model Context Protocol to use external tools in a standard way.
  • Observability with OpenTelemetry: every step of every agent is traced.

And Semantic Kernel?

Existing projects based on Semantic Kernel keep working and are supported; the new framework is the direction for new agent-based projects, with documented migration paths.

Comments (0)

No comments yet.

Leave a comment