Skip to content

RoundRobinGroupChat raises raw AttributeError/TypeError for invalid participants instead of a clear validation error #7580

@emberpath24

Description

@emberpath24

What happened?

Describe the bug
Hi, I noticed that RoundRobinGroupChat does not seem to validate the type of the participants argument before using it.

When participants is accidentally set to None, a string, an integer, or a list containing a non-agent object, the constructor raises low-level Python errors such as:

  • TypeError: object of type 'NoneType' has no len()
  • TypeError: object of type 'int' has no len()
  • AttributeError: 'str' object has no attribute 'name'

I understand these are invalid inputs, but they are realistic user mistakes. It would be much easier to debug if AutoGen raised a clear TypeError or ValueError explaining that participants must be a non-empty list/sequence of ChatAgent instances.

To Reproduce
from autogen_agentchat.agents import UserProxyAgent
from autogen_agentchat.teams import RoundRobinGroupChat

Case 1: participants is None

RoundRobinGroupChat(participants=None)

Case 2: participants is not a sequence of agents

RoundRobinGroupChat(participants="not a list")

Case 3: participants contains a non-agent object

RoundRobinGroupChat(participants=[UserProxyAgent(name="valid_user"), "bad"])

Expected behavior
The constructor should reject these invalid inputs with a clear validation error, for example:

TypeError: participants must be a non-empty sequence of ChatAgent instances

or a similar ValueError explaining which item is invalid.

Actual behavior
The constructor raises internal implementation errors:

RoundRobinGroupChat(participants=None)
-> TypeError: object of type 'NoneType' has no len()

RoundRobinGroupChat(participants="not a list")
-> AttributeError: 'str' object has no attribute 'name'

RoundRobinGroupChat(participants=[UserProxyAgent(name="valid_user"), "bad"])
-> AttributeError: 'str' object has no attribute 'name'

** Environment**
Package: autogen-agentchat
Observed with the local AutoGen checkout / current environment.
Python: 3.13

Additional context
This is not a request to accept these inputs. The issue is only about error handling: invalid user input currently leaks internal AttributeError/TypeError instead of a clear validation message.

Which packages was the bug in?

Python AgentChat (autogen-agentchat>=0.4.0)

AutoGen library version.

Python dev (main branch)

Other library version.

No response

Model used

No response

Model provider

None

Other model provider

No response

Python version

3.10

.NET version

None

Operating system

MacOS

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions