The world of AI development is evolving fast. Microsoft has recently introduced the Microsoft Agent Framework, a new open-source development kit that serves as the unified successor to both Semantic Kernel and AutoGen.
If you’ve been exploring agentic AI, you might be asking: Why another framework?
The Unification of AI Development#
Built by the same teams behind Semantic Kernel and AutoGen, the Microsoft Agent Framework combines the best of both worlds:
- From AutoGen: Simple abstractions for powerful multi-agent orchestration and conversation patterns.
- From Semantic Kernel: Enterprise-grade features like thread-based state management, type safety, telemetry, and robust model support.
It is designed to be the foundation for building AI agents going forward, available for both .NET and Python.
Core Concepts#
The framework is built around two primary capabilities:
1. AI Agents#
An AI Agent is an autonomous unit that uses Large Language Models (LLMs) to process input, make decisions, and take action.
- Tools & MCP: Agents can connect to external tools and Model Context Protocol (MCP) servers to interact with the real world.
- Flexibility: They support various providers including Azure OpenAI, OpenAI, and Azure AI.
2. Workflows#
Workflows allow you to chain agents and functions together to solve complex problems.
- Graph-Based: Define explicit execution paths, loops, and conditional routing.
- Type Safety: Ensure data flows correctly between agents with compile-time checks.
- Checkpointing: Save the state of a workflow, enabling long-running processes that can pause and resume (perfect for human-in-the-loop scenarios).
Getting Started#
To start building with the Microsoft Agent Framework in .NET, you’ll need the .NET 8.0 SDK and an Azure OpenAI resource.
1. Create a Project#
First, create a new console application:
| |
2. Install Packages#
Add the necessary NuGet packages. Note that these are currently in prerelease:
| |
3. Create a Basic Agent#
Here is a simple example of creating an agent that uses Azure OpenAI to tell jokes. This code uses AzureCliCredential for authentication, so make sure you are logged in via az login.
| |
4. Chaining Agents: A Sequential Workflow#
One of the most powerful features is the ability to chain agents together. In this example, we’ll create a sequential pipeline where a message is passed through multiple translation agents.
| |
What happens here?
- The user says “Hello, world!”.
- The French Agent translates it to “Bonjour, le monde !”.
- The Spanish Agent takes that French output and translates it to “¡Hola, mundo!”.
- The English Agent translates it back to “Hello, world!”.
This pattern is perfect for multi-stage processing, such as Draft -> Review -> Polish pipelines.
5. Advanced Orchestration: Dynamic Handoffs#
While sequential chains are useful, real-world tasks often require dynamic decision-making. Handoff Orchestration allows agents to transfer control to one another based on the conversation context.
Imagine a customer support bot that needs to route queries to specialists:
| |
In this workflow, the TriageAgent acts as a router. If the user asks “What is the derivative of x^2?”, the TriageAgent recognizes the intent and hands off execution to the MathAgent. This mimics how human teams delegate tasks based on expertise.
A Simple Mental Model#
When building an app, you will typically:
- Define Agents: Create agents with specific personas and tools (e.g., a “Researcher” agent with web search capabilities).
- Create a Workflow: Define how these agents interact. Does the Researcher pass info to a Writer? Does a Manager review the output?
- Run & Monitor: Execute the workflow, utilizing built-in telemetry to debug and optimize performance.
Why Switch?#
If you are building enterprise applications, the Agent Framework offers critical advantages:
- Reliability: With strong typing and state management, it’s easier to build robust systems that don’t “hallucinate” process steps.
- Scalability: The workflow engine is designed to handle complex, multi-step tasks that would overwhelm a single agent.
- Future-Proof: As the direct successor, this framework will receive the latest features and improvements from Microsoft’s AI teams.
Further Reading#
- Microsoft Agent Framework Documentation - Official documentation
- Agent Framework on GitHub - Source code and examples (part of Semantic Kernel repo)
- Multi-Agent Systems - Concepts and patterns
- Migration from Semantic Kernel - Migration guide
