microsoft/autogen · error · ValueError

Invalid participant component type: {participant.component_t

Error message

Invalid participant component type: {participant.component_type}. Expected ChatAgent or Team.

What it means

SelectorGroupChat._from_config raises ValueError when deserializing a saved component config whose participant entries have a component_type that is neither ChatAgent's nor Team's. Component-based loading must dispatch each participant to the right loader, so unknown component types cannot be reconstructed.

Source

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

            selector_prompt=self._selector_prompt,
            allow_repeated_speaker=self._allow_repeated_speaker,
            max_selector_attempts=self._max_selector_attempts,
            # selector_func=self._selector_func.dump_component() if self._selector_func else None,
            emit_team_events=self._emit_team_events,
            model_client_streaming=self._model_client_streaming,
            model_context=self._model_context.dump_component() if self._model_context else None,
        )

    @classmethod
    def _from_config(cls, config: SelectorGroupChatConfig) -> Self:
        participants: List[ChatAgent | Team] = []
        for participant in config.participants:
            if participant.component_type == ChatAgent.component_type:
                participants.append(ChatAgent.load_component(participant))
            elif participant.component_type == Team.component_type:
                participants.append(Team.load_component(participant))
            else:
                raise ValueError(
                    f"Invalid participant component type: {participant.component_type}. " "Expected ChatAgent or Team."
                )
        return cls(
            participants=participants,
            model_client=ChatCompletionClient.load_component(config.model_client),
            name=config.name,
            description=config.description,
            termination_condition=TerminationCondition.load_component(config.termination_condition)
            if config.termination_condition
            else None,
            max_turns=config.max_turns,
            selector_prompt=config.selector_prompt,
            allow_repeated_speaker=config.allow_repeated_speaker,
            max_selector_attempts=config.max_selector_attempts,
            # selector_func=ComponentLoader.load_component(config.selector_func, Callable[[Sequence[BaseAgentEvent | BaseChatMessage]], str | None])
            # if config.selector_func
            # else None,
            emit_team_events=config.emit_team_events,

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Regenerate the component config via team.dump_component() from the same autogen-agentchat version instead of hand-writing it.
  2. Ensure each participant entry is a full serialized ChatAgent or Team component (has provider, config, component_type keys intact).
  3. Validate participant component types before loading: all(p.component_type in (ChatAgent.component_type, Team.component_type) for p in config.participants).

Example fix

# before
config = json.loads(open("team.json").read())  # participant entry has component_type: "agent"  # invalid
 team = SelectorGroupChat.load_component(config)

# after
# re-export a valid config from a live team
Team.dump_component(team)  # then load this artifact
Defensive patterns

Strategy: validation

Validate before calling

from autogen_agentchat.agents import ChatAgent
from autogen_agentchat.teams import Team
valid_types = {ChatAgent.component_type, Team.component_type}
assert all(p.component_type in valid_types for p in config.participants)
team = SelectorGroupChat.load_component(config)

Type guard

def has_valid_participant_types(config) -> bool:
    valid = {ChatAgent.component_type, Team.component_type}
    return all(p.component_type in valid for p in config.participants)

Try / catch

try:
    team = SelectorGroupChat.load_component(config)
except ValueError as e:
    raise ValueError(f"Component config invalid: {e}. Re-export with dump_component().") from e

Prevention

When it happens

Trigger: SelectorGroupChat.load_component(config) / Team.load_component where config.participants contains a component dict whose 'component_type' is e.g. 'model', 'tool', or a custom/misspelled type; hand-edited or cross-version exported component JSON.

Common situations: Manually crafting or editing component configs; loading a config produced by a different autogen version with changed component schemas; mixing component payloads from other frameworks.

Related errors


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