SkillAgentSearch skills...

Minihack

MiniHack the Planet: A Sandbox for Open-Ended Reinforcement Learning Research

Install / Use

/learn @facebookresearch/Minihack
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<p align="center"> <img width="80%" src="https://raw.githubusercontent.com/facebookresearch/minihack/main/docs/imgs/minihack.png" /> </p>
<p align="center"> <b>Please find MiniHack at its new home at <a href="https://github.com/samvelyan/minihack">github.com/samvelyan/minihack</a></b> </p>

MiniHack is a sandbox framework for easily designing rich and diverse environments for Reinforcement Learning (RL). Based on the game of NetHack, MiniHack uses the NetHack Learning Environment (NLE) to communicate with the game and to provide a convenient interface for customly created RL training and test environments of varying complexity. Check out our NeurIPS 2021 paper and recent blogpost.

MiniHack comes with a large list of challenging environments. However, it is primarily built for easily designing new ones. The motivation behind MiniHack is to be able to perform RL experiments in a controlled setting while being able to increasingly scale the complexity of the tasks.

<p align="center"> <img width="90%" src="https://raw.githubusercontent.com/facebookresearch/minihack/main/docs/imgs/minihack_gameplay_collage.gif" /> </p>

To do this, MiniHack leverages the so-called description files written using a human-readable probabilistic-programming-like domain-specific language. With just a few lines of code, people can generate a large variety of Gymnasium environments, controlling every little detail, from the location and types of monsters, to the traps, objects, and terrain of the level, all while introducing randomness that challenges generalization capabilities of RL agents. For further details, we refer users to our brief overview, detailed tutorial, or interactive notebook.

Our documentation will walk you through everything you need to know about MiniHack, step-by-step, including information on how to get started, configure environments or design new ones, train baseline agents, and much more.

<p align="center"> <img width="90%" src="https://raw.githubusercontent.com/facebookresearch/minihack/main/docs/imgs/des_file.gif" /> </p>

MiniHack Level Editor

The MiniHack Level Editor allows to easily define MiniHack environments inside a browser using a convenient drag-and-drop functionality. The source code is available here.

<p align="center"> <img width="75%" src="https://raw.githubusercontent.com/facebookresearch/minihack/main/docs/imgs/level_editor.png" /> </p>

Language Wrapper

We thank ngoodger for implementing the NLE Language Wrapper that translates the non-language observations from Net/MiniHack tasks into similar language representations. Actions can also be optionally provided in text form which are converted to the Discrete actions of the NLE.

Papers using MiniHack

Open a pull request to add papers.

Installation

The simplest way to install MiniHack is through pypi:

pip install minihack

Extending MiniHack

If you wish to extend MiniHack, please install the package as follows:

git clone https://github.com/facebookresearch/minihack
cd minihack
pip install -e ".[dev]"
pre-commit install

See the full installation guide for further information on installing and extending MiniHack on different platforms, as well as pre-installed Dockerfiles.

Submitting New Environments

For submitting your own MiniHack-based environment to our zoo of public environments, please follow the instructions here.

Trying out MiniHack

MiniHack uses the popular Gymnasium interface for the interactions between the agent and the environment. A pre-registered MiniHack environment can be used as follows:

import gymnasium as gym
import minihack
env = gym.make("MiniHack-River-v0")
env.reset() # each reset generates a new environment instance
env.step(0)  # move agent '@' north
env.render()

To see the list of all MiniHack environments, run:

python -m minihack.scripts.env_list

The following scripts allow to play MiniHack environments with a keyboard:

# Play the MiniHack in the Terminal as a human
python -m minihack.scripts.play --env MiniHack-River-v0

# Use a random agent
python -m minihack.scripts.play --env MiniHack-River-v0  --mode random

# Play the MiniHack with graphical user interface (gui)
python -m minihack.scripts.play_gui --env MiniHack-River-v0

NOTE: If the package has been properly installed one could run the scripts above with mh-envs, mh-play, and mh-guiplay commands.

Baseline Agents

In order to get started with MiniHack environments, we provide a variety of baselines agent integrations.

TorchBeast

A TorchBeast agent is bundled in minihack.agent.polybeast together with a simple model to provide a starting point for experiments. To install and train this agent, first install torchbeast by following the instructions here, then use the following commands:

pip ins
View on GitHub
GitHub Stars512
CategoryEducation
Updated5d ago
Forks67

Languages

Python

Security Score

95/100

Audited on Mar 23, 2026

No findings