Creating Your Own Algorithm
This guide explains how to create your own custom multi-agent environment within the CREW Wildfire framework. In addition to our prebuilt state-of-the-art LLM-based multi-agent agentic algorithms , we offer an easy-to-use modularized template algorithm, prefitted with all the necessary functionality of a working algorithm. We offer this template algorithm with either action or primitive support, depending on your algorithm's planning frequency.
Under crew-algorithms/crew_algorithms/wildfire_alg/algorithms you should find the following structure:
algorithms
├── CAMON
├── COELA
├── Embodied
├── HMAS_2
├── MANUAL
├── TEMPLATE_no-primitives
└── TEMPLATE_primitives
No Primitives
If you do not want your agent's to use prebuilt multi-step actions, use the No Primitives template. You also would use this if your algorithm uses agents that plan a new action every timestep, making multi-step actions redundant.
Navigate to the TEMPLATE_no-primitives folder within the algorithms directory. You will find the following structure:
TEMPLATE_no-primitives
├── prompts/
│ ├── descriptions/ # Textual descriptions of each agent's abilities. Used in Execution Module
│ └── translator/ # Prompts for Translator/Execution Module
│
├── __main__.py # Main Script
├── agent.py # Agent Class. Contains Perception Module
└── utils.py # Utility Methods
For rapid development, we preimplemented the following infrastructure:
- Level generation
- Agent creation
- Communication to the environment
- Agent Perception from raw observations to textual descriptions (optional)
- Agent Single-Action Execution
- Environment Updates
The only required section to develop is the communication/planning phase, which is core to your algorithm.
This is located in the main.py file from line 202:
...
agent_actions = {}
for agent in agents:
agent_actions[agent]=None
TODO: Implement your algorithm below:
# END Algorithm
env_action = [[0,0,0] for _ in range(cfg.envs.num_agents)]
...
After developing your algorithm's communication/planning phase, ensure that each agent's action is set in the agent_actions dictionary like so:
agent_actions[agent] = "planned action"
The action must be a string and any agent with unset actions will do nothing that timestep.
Primitives
If you want your agent to have access to prebuilt multi-step actions, use the Primitives template. You would use this if your algorithm has a dynamic planning frequency dependent on action completion.
Navigate to the TEMPLATE_primitives folder within the algorithms directory. You will find the following structure:
TEMPLATE_primitives
├── prompts/
│ ├── descriptions/ # Textual descriptions of each agent's abilities. Used in Execution Module
│ └── translator/ # Prompts for Translator/Execution Module
│
├── __main__.py # Main Script
├── agent.py # Agent Class. Contains Perception Module
└── utils.py # Utility Methods
For rapid development, we preimplemented the following infrastructure:
- Level generation
- Agent creation
- Communication to the environment
- Agent Perception from raw observations to textual descriptions (optional)
- Agent Multi-Action Execution
- Environment Updates
The only required section to develop is the communication/planning phase, which is core to your algorithm.
This is located in the main.py file from line 198:
...
for agent in agents:
agent.generate_perception(cfg.envs, agent_states, global_data)
#TODO: Implement your algorithm below
# END Algorithm
env_action = [[0,0,0] for _ in range(cfg.envs.num_agents)]
...
After developing your algorithm's communication/planning phase, ensure that each agent's action is set in the agent_actions dictionary like so:
agent_actions[agent] = "planned action"
The action must be a string and any agent with unset actions will do nothing that timestep.
Now you can run your algorithm on created Wildfire levels.