Adding and Running Your Own Agent
Follow these three steps to create and run a new agent.Step 1: Create Your Agent File
First, head over to the ARC-AGI-3-Agents repo and clone itagents/
directory. For this example, let’s copy the random_agent.py
template.
agents/my_awesome_agent.py
and rename the class to MyAwesomeAgent
.
Step 2: Ensure Your Agent is Automatically Registered
To make your agent available to run, add an import statement toagents/__init__.py
and add it to the AVAILABLE_AGENTS
dictionary:
Step 3: Run Your Agent
Your agent is now registered and ready to run. Use the class name in lower case as the value for the--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.
Troubleshooting
Relative Import Errors
If you move an agent file or create a new one outside theagents/
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:
Agent Not Found Errors
If you seeValueError: Agent '<your-agent>' not found
, double-check the following:
- Your agent class is correctly located in the
agents
directory (or a subdirectory). - The class name is correctly spelled and matches the name you provided to the
--agent
flag (in lower case). - You have saved your changes to your agent file.