|
| 1 | +--- |
| 2 | +title: Getting Started with Microsoft Agent Framework |
| 3 | +date: 2026-03-04 |
| 4 | +images: ["post-cover.png"] |
| 5 | +description: Learn what Microsoft Agent Framework is, how it merges Semantic Kernel and AutoGen, and how to build your first agent in Python. |
| 6 | +categories: ["Tutorials", "AI"] |
| 7 | +tags: ["Microsoft Agent Framework", "Semantic Kernel", "AutoGen", "Azure", "AI", "Tutorial"] |
| 8 | +--- |
| 9 | + |
| 10 | +You want to build an AI agent with code. You search "Microsoft agent framework" and find Semantic Kernel. Then AutoGen. Then you realize both are from Microsoft. Two frameworks, same company. |
| 11 | + |
| 12 | +Which one do you pick? |
| 13 | + |
| 14 | +Here's the thing: you don't have to choose anymore. Microsoft merged both projects into a single framework called **Microsoft Agent Framework**. |
| 15 | + |
| 16 | +In my [previous post](https://johanrin.com/posts/how-to-use-model-router-on-microsoft-foundry/), I showed you how to use Model Router on Microsoft Foundry. Today, let's look at this new framework and build our first agent with it. |
| 17 | + |
| 18 | +**In this post, you'll learn how to:** |
| 19 | + |
| 20 | +- Understand where Microsoft Agent Framework comes from |
| 21 | +- Create your first agent in Python |
| 22 | +- Know what else the framework can do |
| 23 | +- See where it fits compared to other frameworks |
| 24 | + |
| 25 | +Let's dive in. |
| 26 | + |
| 27 | +## Where Does It Come From? |
| 28 | + |
| 29 | +Microsoft had two projects running in parallel for a while: |
| 30 | + |
| 31 | +**Semantic Kernel** was the enterprise SDK. Production-ready, well-supported, and popular in the .NET ecosystem. |
| 32 | + |
| 33 | +**AutoGen** came from Microsoft Research. It pioneered multi-agent orchestration patterns like group chat and quickly gained traction in the open-source community. |
| 34 | + |
| 35 | +Both were good. But having two frameworks from the same company was confusing for everyone. |
| 36 | + |
| 37 | +In October 2025, Microsoft decided to merge them. Semantic Kernel's stability meets AutoGen's multi-agent patterns. That's Microsoft Agent Framework. |
| 38 | + |
| 39 | +The framework is open-source and supports both **.NET** and **Python**. |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +## Your First Agent in Python |
| 44 | + |
| 45 | +Enough context. Let's write some code. |
| 46 | + |
| 47 | +Install the package: |
| 48 | + |
| 49 | +```bash |
| 50 | +pip install agent-framework --pre |
| 51 | +``` |
| 52 | + |
| 53 | +> **Note:** The `--pre` flag is required while the framework is in Release Candidate. |
| 54 | +
|
| 55 | +Set up your environment variables: |
| 56 | + |
| 57 | +```bash |
| 58 | +export AZURE_AI_PROJECT_ENDPOINT="https://<your-resource>.openai.azure.com/" |
| 59 | +export AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME="gpt-4o-mini" |
| 60 | +``` |
| 61 | + |
| 62 | +Create your agent: |
| 63 | + |
| 64 | +```python |
| 65 | +import os |
| 66 | +import asyncio |
| 67 | +from dotenv import load_dotenv |
| 68 | +from azure.identity import AzureCliCredential |
| 69 | +from agent_framework.azure import AzureOpenAIResponsesClient |
| 70 | + |
| 71 | +load_dotenv() |
| 72 | + |
| 73 | +async def main(): |
| 74 | + credential = AzureCliCredential() |
| 75 | + client = AzureOpenAIResponsesClient( |
| 76 | + project_endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"], |
| 77 | + deployment_name=os.environ["AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME"], |
| 78 | + credential=credential, |
| 79 | + ) |
| 80 | + |
| 81 | + agent = client.as_agent( |
| 82 | + name="HelloAgent", |
| 83 | + instructions="You are a friendly assistant. Keep your answers brief.", |
| 84 | + ) |
| 85 | + |
| 86 | + result = await agent.run("What is the capital of France?") |
| 87 | + print(result) |
| 88 | + |
| 89 | +if __name__ == "__main__": |
| 90 | + asyncio.run(main()) |
| 91 | +``` |
| 92 | + |
| 93 | +That's it. A few lines and you have a working agent. |
| 94 | + |
| 95 | +You can also stream the response token by token: |
| 96 | + |
| 97 | +```python |
| 98 | +async for chunk in agent.run("Tell me a fun fact.", stream=True): |
| 99 | + if chunk.text: |
| 100 | + print(chunk.text, end="", flush=True) |
| 101 | +``` |
| 102 | + |
| 103 | +From here, you can add tools, multi-turn sessions, and more. But this is all you need to get started. |
| 104 | + |
| 105 | +> **Tip:** Check out the [full sample on GitHub](https://github.com/microsoft/agent-framework/blob/main/python/samples/01-get-started/01_hello_agent.py) for the complete runnable file. The repo contains progressive samples covering [tools, sessions, context providers, and workflows](https://github.com/microsoft/agent-framework/tree/main/python/samples/01-get-started). You'll also find more advanced examples for [agent providers](https://github.com/microsoft/agent-framework/tree/main/python/samples/02-agents) and [workflow orchestration](https://github.com/microsoft/agent-framework/tree/main/python/samples/03-workflows). Microsoft also maintains a dedicated [Agent-Framework-Samples](https://github.com/microsoft/Agent-Framework-Samples) repo with hands-on tutorials from beginner to multi-agent systems. |
| 106 | +
|
| 107 | +## Multi-Agent Workflows |
| 108 | + |
| 109 | +Single agents are great, but real-world applications often need multiple agents working together. |
| 110 | + |
| 111 | +MAF ships with a workflow engine that supports different orchestration patterns: |
| 112 | + |
| 113 | +- **Sequential**: one agent after another |
| 114 | +- **Concurrent**: multiple agents at the same time |
| 115 | +- **Handoff**: one agent passes control to another |
| 116 | +- **Group Chat**: agents discuss together |
| 117 | +- **Magentic**: a manager agent plans, delegates, and coordinates specialized agents for complex tasks |
| 118 | + |
| 119 | +All of them support streaming out of the box. |
| 120 | + |
| 121 | +I'll cover orchestration patterns in a dedicated post. There's a lot to unpack. |
| 122 | + |
| 123 | +## Connecting Tools |
| 124 | + |
| 125 | +MAF supports three ways to connect your agents to external tools and services: |
| 126 | + |
| 127 | +- **MCP** for dynamic tool connections |
| 128 | +- **A2A** for agent-to-agent communication across runtimes |
| 129 | +- **OpenAPI** for any REST API |
| 130 | + |
| 131 | +If you've read my post on [deploying an MCP server on Microsoft Foundry](https://johanrin.com/posts/deploy-mcp-server-microsoft-foundry/), MAF is how you connect those tools to your agents with code. |
| 132 | + |
| 133 | +## How Does It Compare? |
| 134 | + |
| 135 | +MAF is not the only agent framework out there. **LangGraph** and **CrewAI** both have strong communities and real production deployments. |
| 136 | + |
| 137 | +Where MAF stands out is if you're already working with Azure, .NET, or Microsoft 365. The integration is native, you get production SLAs, and compliance is built in. |
| 138 | + |
| 139 | +If you're outside the Microsoft ecosystem, LangGraph or CrewAI might be a better starting point. |
| 140 | + |
| 141 | +## Current Status |
| 142 | + |
| 143 | +As of February 2026, the framework has reached **Release Candidate** for both .NET and Python. The API is stable, all v1.0 features are in, and GA should follow in the coming weeks. |
| 144 | + |
| 145 | +Worth checking out: |
| 146 | + |
| 147 | +- [GitHub repo](https://github.com/microsoft/agent-framework) |
| 148 | +- [RC announcement](https://devblogs.microsoft.com/foundry/microsoft-agent-framework-reaches-release-candidate/) |
| 149 | +- [Quick-start guide](https://learn.microsoft.com/en-us/agent-framework/get-started/your-first-agent) |
| 150 | + |
| 151 | +## Conclusion |
| 152 | + |
| 153 | +The agent framework landscape has been messy. Too many options, too much overlap. Microsoft Agent Framework cleans that up on the Microsoft side by bringing Semantic Kernel and AutoGen together. |
| 154 | + |
| 155 | +If you're building agents on Azure, this is the framework to learn. Give it a try and let me know what you think! |
| 156 | + |
| 157 | +That's it for today. Hope you learned something! |
| 158 | + |
| 159 | +If you have any questions, feel free to reach out on my socials! |
0 commit comments