Group Chat

Also known as: multi-agent conversation, selector team, round-robin team, roundtable, managed conversation, GroupChat / GroupChatManager (AutoGen, AG2), group chat orchestration (Semantic Kernel, Microsoft Agent Framework)

Intent

Put a few specialised agents in one shared, append-only message thread that every one of them reads. After each message, a selector that sits outside the agents picks exactly one of them to speak next. The loop runs until a stop condition fires: a keyword, a message cap, a budget, or an outside stop.

Problem

You are building an assistant that answers sports-statistics questions. A user asks for the percentage change in total rebounds, across two seasons, of the Miami Heat player who scored the most points in 2006–07. A question of this kind is the running example of AutoGen's SelectorGroupChat tutorial (paraphrased here), and it needs three kinds of work: planning, web search (several times), and a calculation.

You split the work into a planner, a web-search agent and a data analyst, and wire them as a fixed chain: plan, search, compute, answer. It breaks as soon as the task needs back-and-forth:

Putting all three roles into one agent with every tool is the other naive option. Its prompt has to hold every role, and nothing tells it when one kind of work is finished.

A fixed chain runs Task, Planner, Searcher, Analyst, Answer in order. The analyst finds a figure missing but has no way to send work back to the searcher, so the answer is incomplete. rebounds missing: no way back to search Task Planner plans once Searcher one query Analyst nothing to compute Answer incomplete
The order of steps is fixed in code. When a result is missing or wrong, the chain has no edge that sends the work back.

Solution

Keep the three agents, but replace the fixed wiring with one shared thread and one decision per turn: who speaks next. Every message is appended to the thread and delivered to every participant. A selector reads the thread and the participants' short descriptions and returns one name. That agent reads the whole thread, replies, and its reply is broadcast. Code checks the stop conditions after every reply.

  1. Seed. The user's question becomes the first message of the thread, and every agent receives it.
  2. Select. The selector sees the roles and the history. A rule says the PlanningAgent speaks first, so it is picked.
  3. Speak and broadcast. The planner writes two lines: "WebSearchAgent : find the Heat's top scorer in 2006–07 and his rebounds in both seasons" and "DataAnalystAgent : compute the percentage change". Everyone sees them.
  4. Select again. The selector picks WebSearchAgent, which runs its own short tool loop (a ReAct loop inside its turn) and posts the figures. If one is missing, the selector can pick it again or return to the planner.
  5. Hand back to the planner. After a specialist reports, the selector returns to the planner, which assigns the next open task. The analyst reads the two rebound totals straight from the thread and posts the percentage.
  6. Stop. The planner writes a short summary that ends with TERMINATE. A termination condition sees the keyword and ends the run, returning the transcript and the stop reason. A message cap and a token budget stop it anyway if the keyword never comes.

Who decides the flow: each agent decides only what it says. The selector decides who speaks next, on every turn. Agents can influence that choice, for example by naming the next agent in their text, but they cannot make it. Code decides when to stop. The developer decides how much freedom the selector has: a fixed rotation, a rule, an allowed-transition graph, or an LLM choosing freely.

The closest neighbour is the Supervisor. A group chat whose selector always returns to the planner looks like a supervisor, but a supervisor's workers do not share one thread: each gets an instruction and reports back to the hub alone. In a group chat every message reaches every participant. In Swarm / Handoffs there is no outside selector at all: the active agent hands control to a peer itself.

Real-world analogy

A small working meeting with a chair. Everyone in the room hears everything that is said, but only one person speaks at a time, and the chair decides who gets the floor next. The chair does not do the work; they look at the agenda and at what was just said and point at the person who should answer. The meeting ends when the item is closed, or when the clock runs out.

The analogy stops at the chair's judgement. A human chair notices when the meeting is going in circles. An LLM selector only sees the transcript and the descriptions you wrote, and it will happily keep calling on people unless you give it rules and a hard stop.

Structure

Three agents and an optional human all read and append to one shared thread. A selector reads the thread and asks one agent to speak. After each reply, termination conditions either stop the run and return the result, or send control back to the selector. the selected agent is asked to speak not done stop PlanningAgent assigns, ends WebSearchAgent search_web DataAnalystAgent percentage_change Human optional Shared thread append-only, broadcast to all Selector reads roles + history returns one name LLM | rule | graph Termination keyword, message cap, token or time budget User task Result answer + stop reason user: % change in rebounds? Planner: WebSearch: find stats WebSearch: 214 and 398 Planner: DataAnalyst: compute % DataAnalyst: +86.0% Planner: summary... TERMINATE 1 2 3 4 5 6
Double-headed lines: each participant reads the whole thread and appends to it when selected. The accent line is the selector's one decision per turn. The dashed line is the selector reading the thread. The transcript figures are illustrative.
  1. Participants. Each agent has a unique name, a short description that the selector reads, a system prompt with its role and output format, and possibly a few tools. It replies only when selected, and may run its own tool loop inside that turn.
  2. Shared thread. One ordered list of messages (source, content, type) that is the single source of truth. Physically, frameworks differ: AutoGen Core broadcasts on a shared topic and each agent keeps its own copy; Microsoft Agent Framework syncs each agent's session before its turn. Logically, everyone sees the same history.
  3. Selector (manager). Picks exactly one next speaker from the candidates. It can be a fixed rotation, a function, an allowed-transition graph, an LLM, or a person. Some managers also decide when to ask a human and how to filter the final result.
  4. Termination conditions. Code that inspects each new reply: a keyword such as TERMINATE or APPROVE, a message cap, a token or time budget, or an external stop button. Conditions combine with AND and OR.
  5. Human participant (optional). A person who approves or redirects as a regular member, a gate the manager consults, or the selector itself in manual mode.
  6. Result. The transcript plus the stop reason, or a filtered answer: the last message, a designated agent's final message, or a summary pass.

Prompt generator

Describe the team's job and each participant: its name, the description the selector will read, its tools, and who may speak after it. The generator writes a shared prefix, one system prompt per participant, the speaker-selection spec (an LLM selector prompt, a rule, or a rotation) and a runtime checklist for the loop. The prompts work with any group-chat runtime (AutoGen or AG2 group chats, Semantic Kernel, Microsoft Agent Framework) or your own loop; the checklist is for your code.

Participants one row per agent, the first row speaks first
Speaker selection

Generated prompt

Highlighted text comes from the form. [Bracketed] text is still to fill in.

Descriptions are the selector's only input

An LLM selector chooses from the names and descriptions you give it, so vague or overlapping descriptions produce wrong picks. Write each description as what the agent does and what it never does, and keep the selector prompt short. The AutoGen docs give the same advice, and add that with reasoning models both selector and agent prompts should stay short and direct.

Applicability

Use it when

Avoid it when

How to implement

  1. Start with one agent. Move to a team only when one agent with tools proves inadequate. AutoGen's teams tutorial and the Azure Architecture Center both say this.
  2. Define two to four roles that do not overlap. Give each a unique name (no spaces is safest), a crisp description for the selector, and a fixed output format in its system prompt, for example "assign tasks as <agent> : <task>".
  3. Pick the weakest selection policy that works. Roughly in this order: round-robin, then a rule or allowed-transition graph, then an LLM selector with a candidate filter, then a free LLM selector. Rules are free and testable; an LLM costs a call per turn and can pick wrongly.
  4. Validate the selector's answer. AutoGen's behaviour is worth copying: count whole-word mentions of each candidate name; if there are none or several, retry with a correction (three attempts by default in AgentChat), then fall back to a fixed choice and log a warning. Skip the call when only one candidate is left.
  5. Define termination in layers. A semantic stop (keyword or approval) that only one designated agent may emit, a hard message cap, and a token or time budget. Add an external stop for UIs. Treat any stop other than the semantic one as a failed run.
  6. Decide what is shared. Should tool calls and raw results go into the thread, or only the speaker's text? Should old turns be summarised? Should the selector see only the last few messages? Microsoft Agent Framework (Python) strips tool content before broadcast by default.
  7. Decide the output and log every selection. Return the last message, a designated agent's final message, or a summary pass. Log candidates, the chosen speaker, the reason, the retries, tokens per message and the stop reason for each run.
Framework support (check current docs before use)
FrameworkHow this pattern appears
AutoGen AgentChat (0.4+)RoundRobinGroupChat, SelectorGroupChat (with selector_prompt, selector_func, candidate_func, allow_repeated_speaker=False by default) and MagenticOneGroupChat. Termination classes such as TextMentionTermination and MaxMessageTermination combine with | and &.
AutoGen 0.2 / AG2GroupChat plus GroupChatManager, with speaker_selection_method set to auto (default), round_robin, random, manual or a function, and allowed_or_disallowed_speaker_transitions for a graph. max_round defaults to 10. AG2 adds AutoPattern, RoundRobinPattern and handoff-based patterns.
Semantic KernelGroupChatOrchestration with a RoundRobinGroupChatManager or a custom GroupChatManager that overrides speaker selection, termination, human-input and result-filter hooks. Marked experimental.
Microsoft Agent FrameworkGroupChatBuilder (Python) with a selection function or an orchestrator agent and a termination condition; .NET and Go builders exist. Described as a star topology with per-agent sessions synced before each turn.
LangGraphNo dedicated class. The "multi-agent collaboration" example has agents share one message list in graph state, with a rule-based router reading the last output.
CAMELRolePlaying: an AI user and an AI assistant in strict alternation, with a message cap, an end token and role-flip detection.

Caveat. According to its GitHub README, the AutoGen repository is archived and in maintenance mode, with Microsoft Agent Framework named as its successor; a Microsoft blog dates Agent Framework 1.0 to April 3, 2026. The October 2025 date for AutoGen's move to maintenance mode comes only from secondary sources and is unverified. AG2 is the community fork that keeps the 0.2-style GroupChat API. Defaults such as max_round=10 or three selector attempts were read at research time and may change, and the Semantic Kernel and Agent Framework API details were not re-checked.

Variants

Round-robin team

A fixed rotation with no selector call. The minimal case is a writer and a reviewer taking turns; Semantic Kernel's sample runs them for five rounds and its docs suggest an odd number so the writer has the last word. Cheap and predictable, but every agent speaks even when it has nothing to add.

Selector group chat

An LLM reads the roles and history and names the next speaker, optionally helped by a function that forces some choices (for example "after any specialist, return to the planner") or narrows the candidates. This is the running example on this page.

Graph-constrained group chat

An allowed-transition graph lists who may follow whom, and the LLM picks only among legal next speakers. The AutoGen FSM GroupChat blog stresses that the graph and the agents' descriptions together form the state machine: the descriptions say when each edge should be taken. StateFlow generalises this into state-driven workflows; its gains over ReAct are single-workflow results, not group-chat benchmarks.

Maker-checker loop

A maker proposes and a checker approves or sends feedback, until approval or an iteration cap. The Azure Architecture Center treats it as a turn-based special case of group chat. As a two-role loop it is the same idea as Evaluator–Optimizer.

Two-agent role-playing (CAMEL)

An "AI user" gives instructions and an "AI assistant" solves them, in strict alternation, after a task-specifier prompt and two role prompts set things up. CAMEL used five stop rules, including an end-of-task token, role-flip detection and a 40-message cap set to control cost.

Chat chain (ChatDev)

A sequence of two-agent chats grouped into phases such as design, coding and testing. Only the solutions from earlier phases carry forward, not the full transcripts, so it sits between group chat and Prompt Chaining.

Orchestrated group chat (Magentic-One)

A manager that plans, keeps task and progress ledgers, detects stalls, picks the next agent and also writes it an instruction. AutoGen exposes it as MagenticOneGroupChat, a drop-in replacement for a selector group chat. Its internals are covered on the Orchestrator–Workers page.

Human in the group

A person takes part as a regular member, as a gate the manager consults before a turn, or as the selector itself. A common form routes to the human right after the planner speaks and returns to the planner unless the reply is "APPROVE". See Human-in-the-Loop.

Publish-subscribe message pool (MetaGPT)

Agents publish structured documents to a shared pool and subscribe by role, so each reads only what concerns it. MetaGPT argues that sharing everything overloads agents. This is the bridge to the Blackboard pattern.

Nested group chats

A whole team acts as one participant in a larger chat. See Hierarchical teams.

Pros and cons

Pros

  • Little orchestration code: you define roles, a selection policy and stop conditions, and the loop does the rest.
  • One readable transcript shows the whole collaboration, which helps debugging and audits.
  • Every agent works from the same facts, so the analyst uses the searcher's exact figures.
  • The number of rounds adapts to the task: a missing figure leads to another search turn instead of a wrong answer.
  • A human can join as a participant, a gate or the selector without changing the structure.
  • The selection policy can move from free to controlled (LLM, graph, rule, rotation) without rewriting the agents.

Cons

  • Context grows every turn and each speaker re-reads the whole thread, so input tokens grow faster than the number of turns. (The research notes estimate roughly quadratic growth; this is their own reasoning, not a measurement.)
  • Turns are serial, and an LLM selector adds a model call per turn, plus retries.
  • Free selection is weak on open-ended tasks. In the Magentic-One paper, replacing its planning orchestrator with plain group-chat speaker selection cut performance on the GAIA validation set by about 31% (relative). That baseline was AutoGen 0.2-style selection; a well-constrained selector may close part of the gap, which is unverified.
  • Conversations loop, drift, or end too early without caps and a designated finisher.
  • Peer critique can hurt weaker models: in AgentVerse, GPT-3.5 groups did worse than solo agents on two tasks, while GPT-4 groups did slightly better.
  • Everything one agent sees, every agent sees, including secrets, tool output and injected instructions from web pages.

Failure modes

Loops and chatter

Agents trade courtesies ("thank you", "you're welcome") or repeat the same exchange. CAMEL observed message loops with no progress, and in the MAST study of failed multi-agent traces, step repetition was the most frequent failure mode (15.7%). You notice it as runs that end on the message cap.

Mitigation: hard caps plus a token budget, a rule that returns to the planner after every specialist, stall detection with re-planning, and an explicit "no small talk" line in every prompt.

Speaker-selection errors

The selector names no agent, two agents, an agent that does not exist, or the wrong expert, or one agent ends up dominating the chat.

Mitigation: validate and retry with feedback, then fall back. Narrow the candidates with a function or a transition graph, disallow immediate repeats, and use distinctive names and descriptions. Letting the planner name the next agent and routing on that with a rule removes most LLM picks.

Premature or missed termination

The stop keyword is never written, is written too early, or appears inside quoted text. MAST reports agents unaware of termination conditions in 12.4% of failures and premature termination in 6.2%.

Mitigation: give exactly one agent the power to stop and match on both source and text. Use a distinctive token, always add caps, and add a final verification turn before the stop.

Weak or no verification

The final answer is never checked. In the AutoGen tutorial's own candidate_func sample run, the planner's summary reported a different percentage from the one the analyst had computed (a tutorial with mock tools, so an illustration, not a measured rate).

Mitigation: a checker with concrete criteria, grounded tools such as code execution or tests, and a final step that cross-checks figures against the thread.

Role drift and flake replies

An assistant starts giving instructions, agents do each other's jobs, or an agent says "I will search..." and stops without acting. CAMEL documented both role flipping and these "flake replies".

Mitigation: strict system prompts ("never flip roles"), fixed output prefixes, narrow tool sets per agent, a rule that the action happens in the same message as the announcement, and a terminator on role violation.

Echoing and conformity

Agents agree with or paraphrase the previous message, or drop a correct answer after a wrong critique. In AgentVerse, about 10% of GPT-3.5's MGSM errors came from exactly that.

Mitigation: give critics explicit acceptance criteria, ask for evidence rather than opinions, use stronger models for critics, and add a non-LLM verifier. In the AutoGen chess example, removing the board agent that validated moves led to illegal moves.

Context explosion

Long threads, tool dumps and screenshots exceed the window or push the task out of focus.

Mitigation: strip tool payloads from the broadcast, summarise or compact between turns, give the selector only the last few messages, or carry forward only solutions as ChatDev does. AgentPrune reports cutting tokens by 28.1–72.8% by pruning redundant messages.

Prompt injection spreading through the thread

A web-reading agent pastes hostile instructions, and every other agent then reads them. The Magentic-One guide warns about prompt injection from web content.

Mitigation: quote or sanitise external content, broadcast summaries instead of raw outputs from risky agents, require human approval before code runs, and sandbox execution.

Relations with other patterns

Further reading