How is the termination condition expressed in an AutoGen GroupChat?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
AutoGen terminates via two layers. An `is_termination_msg` predicate over the last message plus a `max_round` hard ceiling on the GroupChat.
Think of a brainstorming meeting with a written rule and a clock on the wall. The rule says 'when anyone slides a sticky note that says STOP, we are done.' The clock says 'no matter what, the meeting ends after 30 minutes.' Most meetings end on the sticky note. The clock exists for the day everyone forgets the rule and keeps talking. AutoGen runs its multi-agent chat the same way. A predicate checks the last message for a stop signal, and a round counter on the chat ends things if no one ever slides the note.
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.
6 min: predicate semantics, sentinel convention, max_round backstop, agent-level vs manager-level wiring, AutoGen 0.4 TerminationCondition classes.
from autogen import AssistantAgent, UserProxyAgent, GroupChat, GroupChatManager
def is_done(msg):
return "TERMINATE" in (msg.get("content") or "")
assistant = AssistantAgent(
name="planner",
system_message="Solve the task. When finished, write TERMINATE on its own line.",
is_termination_msg=is_done,
)
user = UserProxyAgent(
name="user",
is_termination_msg=is_done,
human_input_mode="NEVER",
)
chat = GroupChat(agents=[assistant, user], messages=[], max_round=12)
manager = GroupChatManager(groupchat=chat, is_termination_msg=is_done)
user.initiate_chat(manager, message="Outline a 1-week launch plan.")
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Relying only on `max_round` and never wiring an `is_termination_msg`. The conversation runs to the ceiling every time, wasting tokens and producing trailing junk turns.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.