microsoft/autogen · error · ValueError

At least two participants are required for SelectorGroupChat

Error message

At least two participants are required for SelectorGroupChat.

What it means

SelectorGroupChat.__init__ raises ValueError when fewer than two participants are provided. Speaker selection between multiple agents is the team's entire purpose; with one agent there is nothing to select, so construction is rejected (use the agent or a different team type).

Source

Thrown at python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_selector_group_chat.py:638

        emit_team_events: bool = False,
        model_client_streaming: bool = False,
        model_context: ChatCompletionContext | None = None,
    ):
        super().__init__(
            name=name or self.DEFAULT_NAME,
            description=description or self.DEFAULT_DESCRIPTION,
            participants=participants,
            group_chat_manager_name="SelectorGroupChatManager",
            group_chat_manager_class=SelectorGroupChatManager,
            termination_condition=termination_condition,
            max_turns=max_turns,
            runtime=runtime,
            custom_message_types=custom_message_types,
            emit_team_events=emit_team_events,
        )
        # Validate the participants.
        if len(participants) < 2:
            raise ValueError("At least two participants are required for SelectorGroupChat.")
        self._selector_prompt = selector_prompt
        self._model_client = model_client
        self._allow_repeated_speaker = allow_repeated_speaker
        self._selector_func = selector_func
        self._max_selector_attempts = max_selector_attempts
        self._candidate_func = candidate_func
        self._model_client_streaming = model_client_streaming
        self._model_context = model_context

    def _create_group_chat_manager_factory(
        self,
        name: str,
        group_topic_type: str,
        output_topic_type: str,
        participant_topic_types: List[str],
        participant_names: List[str],
        participant_descriptions: List[str],
        output_message_queue: asyncio.Queue[BaseAgentEvent | BaseChatMessage | GroupChatTermination],

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Provide at least two participants to SelectorGroupChat.
  2. If you genuinely have one agent, run the agent directly (agent.run_stream) or use a single-agent setup instead of SelectorGroupChat.
  3. Validate len(participants) >= 2 in your team-building code before construction.

Example fix

# before
team = SelectorGroupChat(participants=[assistant], model_client=client)  # ValueError

# after
team = SelectorGroupChat(participants=[assistant, reviewer], model_client=client)
Defensive patterns

Strategy: validation

Validate before calling

if len(participants) < 2:
    raise ValueError("SelectorGroupChat needs >= 2 participants")
team = SelectorGroupChat(participants=participants, model_client=client)

Prevention

When it happens

Trigger: SelectorGroupChat(participants=[single_agent], model_client=client); a dynamically built list that ends up with one element.

Common situations: Degenerate config files or filtered agent pools producing a single participant; prototyping with one agent before adding more.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/d5ea01ee44efc4a2. Report an issue: GitHub.