Multi Agent PettingZoo : Agents with different Observations

Hello everyone !

I hope you’re all having a great day. I’m working on a project to model multi-agent learning using a PettingZoo MARL environment. The catch is that each there are two types of agents, each with their distinct observation spaces. When I run my setup, I get an error of the form:

AssertionError: Observation spaces for all agents must be identical. Perhaps SuperSuit’s pad_observations wrapper can help (useage: supersuit.aec_wrappers.pad_observations(env)

Doing a little digging, I discover that the error is raised by the ParallelPettingZooEnv wrapper that I’m using to translate a ParallelEnv to RLlib’s version. Here’s a MWE:

Pastebin for MWE

I’m currently on PettingZoo: 1.22.3, ray[rllib]==2.4.0 and gymnasium==0.28.1.

Can you guys help me find what to do, please? Thanks so much! Of course, if there’s any further information I can give, I’d love to!

Thanks again!

In any case, the excellent examples on the repo had the answer: I found this a bit late, but essentially ended up implementing something like this: (Example) Multi Agent Environment with Different Spaces

Script has been moved to different_spaces_for_agents.py

1 Like

Hello,

Thanks a lot for posting your solution and an update! it appears the codebase has changed again as running the different_spaces_for_agents.py script returns the following error:
ImportError: cannot import name ‘add_rllib_example_script_args’ from ‘ray.rllib.utils.test_utils’
I couldn’t find those in RLlib utils. would you have any pointers to what those tests did or anything else i could use for multi-agent environments (with different observation spaces)?

Thanks!