← Master Index
Vol. 14 Module 14.3 Lecture

AutoGen

LangChain & Orchestration Frameworks

How This Lesson Fits the Module & Volume

AutoGen (Microsoft) popularized multi-agent systems as conversable agents that message each other—assistant, user proxy, critics—to solve tasks. Alongside CrewAI, it prepares you for Volume 15 multi-agent design, while differing from LangGraph’s explicit graph style.

Learning Objectives

By the end of this lesson, students should be able to:

  • Explain AutoGen’s conversable-agent / multi-agent chat model.
  • Sketch assistant + user-proxy collaboration with code execution patterns.
  • Compare AutoGen, CrewAI, and LangGraph orchestration styles.
  • Identify when conversation-based agents help or thrash.
  • Apply termination conditions and human-in-the-loop hooks.
  • Relate AutoGen patterns to Volume 15 agent loops and tools.
Definition

AutoGen is an open-source framework for building multi-agent LLM applications where agents communicate via messages. Agents can be LLM-backed, tool-enabled, or human proxies, coordinating through chat patterns to complete tasks.

Three Multi-Agent Styles

FrameworkMetaphorControl emphasis
AutoGenConversations / chatsMessage protocols, speakers
CrewAIRoles on a crewTasks + process
LangGraphState machine / graphNodes, edges, checkpoints

Assistant + User Proxy Sketch

# Conceptual AutoGen-style pattern (API names vary by version) from autogen import AssistantAgent, UserProxyAgent assistant = AssistantAgent( name="assistant", system_message="You are a helpful coding assistant. Propose plans, then code.", llm_config={"model": "gpt-4o-mini"}, ) user = UserProxyAgent( name="user_proxy", human_input_mode="NEVER", # or ALWAYS for HITL code_execution_config={"work_dir": "coding", "use_docker": False}, ) user.initiate_chat( assistant, message="Write a Python function that cosine-similarities two vectors.", )

When Conversation Helps

Strong fits

  • Code iterate/fix loops
  • Debate / critique pairs
  • Human proxy approvals

Weak fits

  • Strict latency SLAs
  • Simple one-shot RAG
  • Highly regulated scripts

Safeguards

  • Max turns
  • Clear termination
  • Sandbox code exec

Strengths

  • Natural multi-agent chat UX
  • Human proxy patterns
  • Code-oriented workflows
  • Influential agent ecosystem

Tradeoffs

  • Chats can wander
  • Version/API evolution
  • Harder formal guarantees
  • Cost of long dialogues
Common Misconception

“Agents chatting will converge eventually.” Without max turns, termination messages, and success checks, they can loop politely forever—burning budget. Always define stop conditions.

Knowledge Check

  1. Short Answer: What interaction style is AutoGen known for? Answer: Multi-agent conversations / messaging.
  2. True/False: A user proxy can represent a human or automated executor. Answer: True.
  3. Multiple Choice: LangGraph emphasizes: (a) only BM25, (b) explicit state graphs, (c) CSS grids. Answer: (b).
  4. Short Answer: Name one safeguard for chat agents. Answer: Max turns, termination conditions, sandboxed tools (any).
  5. True/False: AutoGen is ideal as the only layer for a tiny FAQ RAG. Answer: False—overkill for simple RAG.
  6. Multiple Choice: CrewAI’s primary metaphor is: (a) roles/crew, (b) SQL joins, (c) convolution. Answer: (a).
  7. Short Answer: Why sandbox code execution? Answer: Agents may run unsafe or incorrect code.
  8. Short Answer: How does this lecture bridge to Vol 15? Answer: Multi-agent chat/tool loops preview agent systems.
  9. Multiple Choice: Missing termination often causes: (a) free inference, (b) endless costly chats, (c) perfect answers. Answer: (b).
  10. True/False: Critique-style agent pairs are a common AutoGen pattern. Answer: True.

Key Takeaways

  • AutoGen orchestrates agents through conversational message passing.
  • User proxies enable HITL and tool/code execution patterns.
  • Choose chat vs crew vs graph based on control and task shape.
  • Always bound turns and validate success.
  • Next: PydanticAI for typed, schema-first agents.
Trainer’s Guide

Discussion: Map the same “write + review code” task onto AutoGen chat, CrewAI roles, and LangGraph nodes.

Safety lab: Require students to add an explicit max-turn termination before any demo.

Recap: AutoGen multi-agent chats are powerful but must be bounded. Continue with PydanticAI.