def agent(self):
        """A helper to return the agent only in the single-agent environment!"""
        assert len(self.agents) == 1, (
            "env.agent is only supported in single-agent environment!"
            if len(self.agents) > 1 else "Please initialize the environment first!"
        )
        return self.agents[DEFAULT_AGENT]
A helper to return the agent only in the single-agent environment!
metadrive/envs/base_env.py