Swarms are used to orchestrate multiple agents across multiple games simultaneously.
agents/
directory. For this example, let’s copy the random_agent.py
template.
agents/my_awesome_agent.py
and rename the class to MyAwesomeAgent
.
agents/__init__.py
and add it to the AVAILABLE_AGENTS
dictionary:
--agent
argument.
main.py
script handles looking up your agent in the registry, instantiating it, and running it against the specified games.
The replay of your agent is available at the end of the run. Make sure to watch your agent at play.
agents/
directory, you may encounter ImportError
exceptions related to relative imports.
Solution:
Ensure your import statements use the correct relative pathing. The ..
prefix goes up one directory level.
For example, if your agent is in agents/my_agents/my_file.py
, the imports should look like this:
ValueError: Agent '<your-agent>' not found
, double-check the following:
agents
directory (or a subdirectory).--agent
flag (in lower case).