Agentic AI Notebook
Phase 15

AutoGen (Legacy / Migration)

~3 min read

Concept & How It Works

  • Key points are in the visual diagram above.

Why Does It Exist?

AutoGen solved conversational teams — a coder and reviewer discussing solutions. New greenfield work on the Microsoft stack should use Microsoft Agent Framework. This lesson is migration awareness: how AutoGen modeled agents as conversable entities that exchange messages.

Real-World Analogy

AutoGen is like a group chat where each participant is an AI specialist — they discuss, debate, and build on each other's messages until the problem is solved.
Loading diagram...

Visual Workflows

What is AutoGen (Legacy / Migration)?

Loading diagram...

Example

Scenario

Coding task: UserProxy sends 'build a REST API for todos.' Coder agent writes code → UserProxy executes in Docker → Tester agent writes tests → Reviewer agent checks quality → iterate until tests pass.

Solution

In Microsoft Agent Framework, apply AutoGen (Legacy / Migration) to this scenario: Coding task: UserProxy sends 'build a REST API for todos. Identify the inputs, run the technique, validate the output, and note one thing you would monitor in production.

Practice Task

Do this before moving to the next module — reading alone is not enough.

Open the Code Walkthrough below and run it locally. Change one parameter related to AutoGen (Legacy / Migration) (e.g. model, temperature, top_k, or tool name), observe the difference in output, and write 2–3 sentences explaining what changed.

Code Walkthrough

Highlighted lines show where AutoGen (Legacy / Migration) happens in the code.

AutoGen (Legacy / Migration)
1from autogen import AssistantAgent, UserProxyAgent, GroupChat, GroupChatManager  # import dependencies2
3coder = AssistantAgent(4    name="coder",5    system_message="You are a Python developer. Write clean, tested code.",6    llm_config={"model": "gpt-4o"},7)8
9reviewer = AssistantAgent(10    name="reviewer",11    system_message="You review code for bugs, security, and best practices.",12    llm_config={"model": "gpt-4o"},13)14
15user_proxy = UserProxyAgent(16    name="user",17    human_input_mode="NEVER",18    code_execution_config={"work_dir": "output", "use_docker": True},19)20
21group_chat = GroupChat(agents=[coder, reviewer, user_proxy], messages=[], max_round=10)22manager = GroupChatManager(groupchat=group_chat, llm_config={"model": "gpt-4o"})23
24user_proxy.initiate_chat(manager, message="Build a FastAPI todo app with tests")

Commands to Remember

Commands to Remember

  • pip install agent-framework # Microsoft Agent Framework
  • pip install autogen-agentchat # AutoGen (legacy / migration)

Common Mistakes

  • No max_round — agents converse indefinitely
  • Code execution without Docker sandbox
  • GroupChat for simple sequential tasks — overkill
  • Not defining clear system messages per agent
  • Ignoring AG2 migration for new projects

Cheat Sheet

Quick recap — the most important points from this module.

Cheat Sheet

quick ref
  • ConversableAgent + message passing
  • UserProxyAgent = code execution
  • GroupChat + Manager
  • Docker sandbox required
  • max_round = termination
  • AG2 for async production