Skip to main content
This guide helps AutoGen developers move to the Microsoft Agent Framework (AF) with minimal guesswork. The frameworks share similar multi-agent primitives but differ in default behaviors, tool handling, and orchestration patterns.
All migration samples are available in the autogen-migration samples directory.

Key Differences at a Glance

API Mapping Reference

Basic Agent Creation

Critical Default Behavior Difference: AutoGen’s AssistantAgent is single-turn by default (max_tool_iterations=1), while AF’s Agent is multi-turn and continues tool execution automatically until completion.

Tools and Functions

AutoGen uses FunctionTool wrappers; AF uses @tool decorators with automatic schema inference from Python type hints and docstrings.

Thread Management

Streaming Responses

Orchestration Pattern Migrations

Round Robin Group Chat → Sequential Builder

AutoGen’s RoundRobinGroupChat executes agents in order. AF provides SequentialBuilder for the same pattern.
For AutoGen patterns with multiple rounds, use AF’s WorkflowBuilder with cyclic edges:

Selector Group Chat → Group Chat Builder

AutoGen’s SelectorGroupChat uses an LLM to choose the next speaker. AF’s GroupChatBuilder provides the same capability.

Swarm Pattern → Handoff Builder

AutoGen’s Swarm enables agent handoffs. AF’s HandoffBuilder provides structured handoff coordination.
AF’s HandoffBuilder supports human-in-the-loop patterns via HandoffAgentUserRequest for interactive workflows.

Magentic One → Magentic Builder

AutoGen’s MagenticOneGroupChat provides orchestrated multi-agent workflows. AF has a direct equivalent.

Agent as Tool Pattern

Both frameworks support using agents as tools for hierarchical agent patterns.

Breaking Changes and Deprecations

Important Breaking Changes
  1. Default Behavior: AutoGen agents are single-turn by default; AF agents are multi-turn. Adjust max_tool_iterations expectations.
  2. Thread Management: AutoGen maintains conversation state implicitly; AF requires explicit create_session().
  3. Tool Wrappers: AutoGen’s FunctionTool must be replaced with AF’s @tool decorator.
  4. Message Types: AutoGen uses ChatMessage/TextMessage; AF uses Message with .text, .role, and .author_name.
  5. Termination Conditions: AutoGen’s TerminationCondition classes must be converted to AF’s lambda-based or custom termination logic.
  6. Handoff Messages: AutoGen’s HandoffMessage must be replaced with AF’s HandoffAgentUserRequest for human-in-the-loop patterns.

Migration Checklist

1

Update agent construction

Replace AssistantAgent(model_client=...) with client.as_agent(...)
2

Convert tools

Transform FunctionTool wrappers to @tool decorated functions
3

Add explicit sessions

Create sessions with agent.create_session() for stateful conversations
4

Adjust default behavior expectations

Account for AF’s multi-turn default (vs. AutoGen’s single-turn default)
5

Update orchestration patterns

  • RoundRobinGroupChat → SequentialBuilder
  • SelectorGroupChat → GroupChatBuilder
  • Swarm → HandoffBuilder
  • MagenticOneGroupChat → MagenticBuilder
6

Convert termination conditions

Replace AutoGen termination classes with AF’s lambda-based conditions
7

Test streaming behavior

Update streaming logic to handle AF’s AgentResponseUpdate events

Common Migration Patterns

Converting System Messages

Converting Descriptions

Converting Streaming

Additional Resources

Migration Samples

Runnable side-by-side code comparisons for all patterns

Agent Framework Docs

Complete documentation for the Agent Framework

AutoGen Docs

Official AutoGen documentation

Community Support

Get help from the community on Discord

Migration Tips

Run both implementations side-by-side during migration. Each sample script runs AutoGen first, then AF, so you can compare outputs in a single execution.
  • Start with single-agent patterns before multi-agent orchestrations
  • Test default behavior early — AF’s multi-turn default can produce different results than AutoGen’s single-turn default
  • Use explicit sessions liberally during development; optimize session management after achieving parity
  • For group chats, AF’s GroupChatBuilder simplifies speaker selection — no need to manually track turn order
  • Handoff patterns are more structured in AF; use HandoffBuilder for clearer coordination logic
  • Tool approval is explicit in AF via approval_mode; always use "always_require" in production for actions

Installation Commands

The --pre flag is needed during the Agent Framework preview period. Both SDKs can coexist in the same environment for gradual migration.