Walk through AutoGen GroupChat handoffs between UserProxyAgent and AssistantAgent
AutoGen routes every turn through a GroupChatManager whose select_speaker policy chooses the next agent; the UserProxyAgent doubles as the human stand-in and the tool executor.
Picture a small meeting with a chairperson, a question-asker, and an expert. The chairperson never answers questions. They just point at whoever should speak next. The question-asker raises their hand and asks something. The chair points at the expert. The expert says, 'I need to look that up in the filing cabinet first,' so the chair points back at the question-asker, who in this room is also the person who can open the cabinet. They read out what they found, the chair points at the expert again, and the expert gives the final answer. Everyone hears every word; nothing is whispered. The meeting ends when someone says the magic stop phrase.
Detailed answer & concept explanation~5 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 minutes: who the manager is, what select_speaker does, why the UserProxy owns tool execution, and how termination is wired.
from autogen import AssistantAgent, UserProxyAgent, GroupChat, GroupChatManager
assistant = AssistantAgent(
name="assistant",
llm_config={"model": "claude-sonnet-4-6"},
)
user = UserProxyAgent(
name="user",
human_input_mode="NEVER",
code_execution_config={"work_dir": "runs", "use_docker": True},
is_termination_msg=lambda m: "TERMINATE" in m.get("content", ""),
)
chat = GroupChat(agents=[user, assistant], messages=[], max_round=12)
manager = GroupChatManager(groupchat=chat, llm_config={"model": "gpt-5.5"})
user.initiate_chat(manager, message="Compute the SHA-256 of 'autogen'. End with TERMINATE.")Real products, models, and research that use this idea.
- Microsoft Research's original AutoGen paper, which introduced GroupChat as a generalisation of two-agent chat for conversable multi-agent programs.
- AutoGen Studio (the no-code UI shipped by the AutoGen team) exposes the speaker-selection policy directly as a dropdown, illustrating how central the routing primitive is.
- Production deployments commonly pair AutoGen GroupChats with Claude Sonnet 4.6 or GPT-5.5 as the AssistantAgent's underlying model, and a cheaper model as the LLM-driven speaker selector.
- The AutoGen GitHub `notebook/agentchat_groupchat.ipynb` example is the canonical reference implementation of this exact UserProxy + Assistant loop.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you implement a custom select_speaker that always routes tool outputs back to the assistant?
QWhat happens if two agents both can execute code and the manager picks the wrong one for a tool call?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating the UserProxyAgent as only the human relay and forgetting it is also the side that runs tool calls. So disabling code execution silently breaks every tool-using turn.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.