AutoGen Framework

Master Microsoft AutoGen for building multi-agent conversational AI systems

Core AutoGen Concepts

AutoGen is built on a few fundamental concepts: conversable agents that communicate through messages, conversation patterns that define how agents interact, and termination conditions that determine when conversations end.

Interactive: Agent Types Explorer

πŸ”„ Conversation Patterns

πŸ’¬

Two-Agent Chat

Simplest pattern: two agents converse back and forth until task completion or max turns reached.

user_proxy.initiate_chat(assistant, message="...")
πŸ”—

Sequential Chat

Chain multiple two-agent conversations where output of one becomes input to next.

A β†’ B β†’ C β†’ D (pipeline pattern)
πŸ‘₯

Group Chat

Multiple agents participate with dynamic speaker selectionβ€”manager decides who speaks next.

GroupChat([agent1, agent2, agent3], manager)
🎭

Nested Chat

Agent triggers sub-conversation with other agents before responding to main conversation.

Main chat β†’ Sub-chat (internal) β†’ Resume main

🎯 Message Flow & Termination

Message Flow: Agents communicate by sending dictionaries withcontent,role, and optionalfunction_call. AutoGen automatically manages conversation history, context windows, and message routing.

Termination: Conversations end when: (1) max turns reached, (2) termination message detected (e.g., "TERMINATE"), (3) custom condition met, or (4) human approval rejected. This prevents infinite loops and controls costs.

is_termination_msg=lambda x: x.get("content", "").find("TERMINATE") >= 0
← Prev