Python API - num-agents

Hi,

I have a question regarding the python API. I am trying to get the total number of agents for my own algorithm. I try to just add the length of decision steps and terminal steps to get the total number of agents in the beginning:

env.reset()
for brain in env.behavior_specs:
            decision_steps, terminal_steps = env.get_steps(brain)
            num_agents = len(decision_steps) + len(terminal_steps)

But somehow I get 24 decision steps and 1 terminal step(=25), although I only have 24 agents in the environment, even though I also called env.reset() before.
What am I missing?

Hi,

The same agent can both terminate and request a decision in the same env.get_steps().
That happens when an agent terminates (dies in the environment or succeeds) and resets as a result. The agent will both :

  • Inform you that it reached a terminal state
  • Request a decision for the start of the new episode
1 Like