Migrating from AutoGen to Microsoft Agent Framework: A Step-by-Step Guide
How to Upgrade Legacy AutoGen Multi-Agent Pipelines to Microsoft's Unified Production SDK
On this page7 sections
Full Article
Read the complete article, including examples, background, practical insights, and technical details.
On November 20, 2026, Microsoft officially archived the AutoGen repository, marking the end of an era for one of the most influential multi-agent research frameworks. In its place, Microsoft is directing all developers to the Microsoft Agent Framework (MAF)—a unified, production-ready SDK that merges the multi-agent patterns of AutoGen with the enterprise abstractions of Semantic Kernel across both Python and .NET.
If you have existing prototypes or production services built on autogen_agentchat or autogen_core, your prompts and tool functions still carry over cleanly—but your orchestration, state management, and package dependencies need an upgrade.
In this tutorial, you'll learn how AutoGen concepts map to Microsoft Agent Framework and walk through migrating a multi-agent workflow step by step.
AutoGen vs. Microsoft Agent Framework: Concept Mapping
Before touching code, map your existing AutoGen primitives to their MAF equivalents:
| Concept | Legacy AutoGen | Microsoft Agent Framework (MAF) |
|---|---|---|
| Packages | autogen_core, autogen_agentchat |
agent_framework, agent_framework.orchestrations |
| Agent Definition | AssistantAgent(model_client=..., system_message=...) |
Agent(client=..., instructions=...) / ChatClientAgent |
| Tools | Manual schema wrappers & registration | Plain Python functions with @tool & type hints |
| Orchestration | RoundRobinGroupChat / event-driven core |
Typed Workflow & WorkflowBuilder graphs |
| Conversation State | Ephemeral per-run state | Managed AgentSession & AgentThread |
| Cross-Cutting Concerns | Custom wrappers | Built-in AgentMiddleware & OpenTelemetry |
Step 1: Audit and Swap Dependencies
Start by removing legacy autogen-* packages from your environment and installing agent-framework.
# Uninstall legacy AutoGen packages
pip uninstall -y autogen-agentchat autogen-core autogen-ext
# Install Microsoft Agent Framework
pip install agent-frameworkIf you are pinning dependencies in pyproject.toml or requirements.txt, replace all autogen_* entries with agent-framework and pin a specific version so CI builds remain deterministic.
Step 2: Convert AssistantAgent and Tool Registrations
In legacy AutoGen, you typically created an OpenAIChatCompletionClient and passed it to AssistantAgent with system_message and manually registered tool functions.
Before (Legacy AutoGen):
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
def lookup_order_status(order_id: str) -> str:
return f"Order {order_id}: Shipped"
model_client = OpenAIChatCompletionClient(model="gpt-4o")
support_agent = AssistantAgent(
name="support_agent",
model_client=model_client,
tools=[lookup_order_status],
system_message="You are a helpful order support specialist.",
)After (Microsoft Agent Framework):
In MAF, decorate your Python function with @tool so type hints and docstrings automatically generate the JSON schema, and pass instructions to Agent:
from agent_framework import Agent, tool
@tool
def lookup_order_status(order_id: str) -> str:
"""Look up the current shipping status for a given order ID."""
return f"Order {order_id}: Shipped"
support_agent = Agent(
name="support_agent",
client=chat_client, # Configured AzureOpenAI / OpenAI chat client
instructions="You are a helpful order support specialist.",
tools=[lookup_order_status],
)Notice how much cleaner tool definitions become—if you've built tool-using agents in frameworks like Smolagents or Google ADK, the @tool pattern will feel immediately familiar.
Step 3: Replace RoundRobinGroupChat with WorkflowBuilder
One of the biggest pain points in AutoGen was relying on implicit conversational loops (RoundRobinGroupChat or SelectorGroupChat) even when parts of a pipeline needed deterministic control flow.
In MAF, WorkflowBuilder lets you compose typed graphs that mix LLM agents with deterministic Python validation nodes:
from agent_framework.orchestrations import WorkflowBuilder
# Define a deterministic pipeline: Research -> Draft -> Quality Gate
workflow = (
WorkflowBuilder()
.add_node("researcher", researcher_agent)
.add_node("writer", writer_agent)
.add_node("validate", deterministic_schema_check)
.add_edge("researcher", "writer")
.add_edge("writer", "validate")
.set_entry("researcher")
.build()
)
result = await workflow.run("Draft release notes for v2.4")Why this matters: Putting a deterministic validation function (deterministic_schema_check) right inside the graph prevents an LLM from hallucinating a passing status or looping indefinitely.
Step 4: Add AgentSession State and AgentMiddleware
Legacy AutoGen left long-lived conversation persistence and observability largely up to you. MAF includes first-class primitives for both:
- Session Persistence (
AgentSession): Maintain multi-turn user state across HTTP requests or background workers without manually serializing message arrays. - Middleware (
AgentMiddleware): Intercept model and tool calls in one place to enforce rate limits, redact PII, log token spend, or emit OpenTelemetry traces.
from agent_framework import AgentMiddleware
class AuditMiddleware(AgentMiddleware):
async def process(self, context, next_step):
print(f"[AUDIT] Invoking agent={context.agent.name}")
response = await next_step(context)
print(f"[AUDIT] Completed agent={context.agent.name}")
return responseAttach middleware at the agent or workflow level so every tool call and model invocation is observable in production.
Migration Checklist
Before retiring your AutoGen branch, run through this checklist:
- Replace
autogen_core/autogen_agentchatimports withagent_framework - Annotate all tool functions with
@tooland clear docstrings - Replace open-ended
GroupChatloops with explicitWorkflowBuildergraphs where order matters - Wire
AgentSessionfor multi-turn state andAgentMiddlewarefor logging/guardrails - Verify MCP (Model Context Protocol) tool servers connect cleanly if you share tools across agents
Key Takeaways
- AutoGen is officially archived: As of November 20, 2026, new features, security fixes, and enterprise support live in Microsoft Agent Framework.
- Prompts and tools transfer easily: Your business logic doesn't need a rewrite—just update the agent wrapper and
@tooldecorators. - Better production control: Moving from implicit group chats to typed
WorkflowBuildergraphs andAgentMiddlewaregives you predictable, observable agent pipelines.
Comments load as you scroll…