# Issues with MultiAgentEnv

**URL:** <https://discuss.ray.io/t/issues-with-multiagentenv/12041>\
**Category:** RLlib\
**Created:** [September 5, 2023, 10:07pm UTC](https://discuss.ray.io/t/issues-with-multiagentenv/12041 "2023-09-05T22:07:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TessMills](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/tessmills/32/4987_2.png) [@TessMills](https://discuss.ray.io/u/TessMills)\
**Post date:** [September 5, 2023, 10:07pm UTC](https://discuss.ray.io/t/issues-with-multiagentenv/12041/1 "2023-09-05T22:07:20Z")

</div>

**How severe does this issue affect your experience of using Ray?**

- High: It blocks me to complete my task.

I keep receiving the following error message, which is odd, as my environment is an extension of MultiAgentEnv. Is there anything else I need to do in order for my environment to pass the check successfully?

ValueError: Have multiple policies \<PolicyMap lru-caching-capacity=100 policy-IDs=[‘shared\_policy’]\>, but the env \<OrderEnforcing\<PassiveEnvChecker\<RoutingEnv\>\>\> is not a subclass of BaseEnv, MultiAgentEnv, ActorHandle, or ExternalMultiAgentEnv!

```auto
class RoutingEnv(MultiAgentEnv):
metadata = {
        "render_modes": ["human"]
    }

    def __init__ (self, render_mode="human", **kwargs):
        super(). __init__ ()

```

```auto
gym.envs.register(
    id="MyEnv-v0",
    entry_point='routing_rl.envs:RoutingEnv',
    kwargs={"config": param_config}
)
env_name = "MyEnv-v0"
train_steps = 200000
learning_rate = 1e-3
save_dir = "saved_models"

def register(config):

    env = gym.make("MyEnv-v0")
    return env

# register the predefined scenario with RLlib
register_env("MultiEnv", register)

config = (
    PPOConfig()
    .training(lr=0.001, _enable_learner_api=False)
    .environment(env="MultiEnv")
    .environment(disable_env_checking=True)
    # RLlib needs +1 CPU than configured below (for the driver/trainer?)
    .resources(num_cpus_per_worker=1)
    .rollouts(num_rollout_workers=0)
    .multi_agent(
        policies={"shared_policy": PolicySpec()},
        policy_mapping_fn=lambda agent_id, episode, worker, **kwargs: "shared_policy",
    )

```

---

<div class="post-metadata">

**Author:** ![Lars\_Simon\_Zehnder](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/lars_simon_zehnder/32/1185_2.png) [@Lars\_Simon\_Zehnder](https://discuss.ray.io/u/Lars_Simon_Zehnder)\
**Post date:** [September 7, 2023, 8:25am UTC](https://discuss.ray.io/t/issues-with-multiagentenv/12041/2 "2023-09-07T08:25:27Z")

</div>

@TessMills it looks like you the code is not reproducable. Did you setup the `RoutingEnv` as a `MultiAgentEnv` with outputs for all agents?
