This release is a pre-release and may not be stable for production use.
GridHunt
Heterogeneous, mixed-motive predator-prey environments for multi-agent reinforcement learning
and human-agent teaming, with a PettingZoo ParallelEnv API.
Documentation: ajuanijustus.github.io/gridhunt.
- Heterogeneous agents: capture power, vision radius, speed and terrain restrictions are set per agent.
- Mixed-motive scenarios: stag hunts, toxic prey, risky targets, roles that only scout.
- Human-agent teaming:
gridhunt.hatruns studies with people in or on the loop: keyboard control with reaction times, AI teammates, buttons that switch teams of policies, cues only the participant sees, questionnaires and per-participant JSON Lines logs. - Baselines: IPPO, MAPPO and HAPPO over 20 seeds, reported as IQM with 95% bootstrap CIs (benchmark/).
Install
pip install gridhunt # environments only (numpy, gymnasium, pettingzoo)
pip install "gridhunt[render]" # + pygame window, rgb_array frames and the interactive GUI
pip install "gridhunt[hat]" # + the human-agent teaming toolkit
From source:
git clone https://github.com/ajuanijustus/gridhunt.git
cd gridhunt
pip install -e ".[dev]"
Quick start
import gridhunt
env = gridhunt.make("GridHunt-ClassicStag-v0")
obs, infos = env.reset(seed=42)
while env.agents:
actions = {agent: env.action_space(agent).sample() for agent in env.agents}
obs, rewards, terminations, truncations, infos = env.step(actions)
gridhunt.list_envs() lists the registered environments. Any scenario setting can be overridden,
for example gridhunt.make("GridHunt-ToxicStag-v0", max_steps=200, reward_mode="team"). With
PettingZoo 1.27 or later, import gridhunt also registers every environment with PettingZoo, so
pettingzoo.make("parallel", "GridHunt-ClassicStag-v0") works too.
Human-agent teaming
import gridhunt
from gridhunt.hat import ARROW_KEYS, HumanSession, Likert, Questionnaire, SessionLog
from gridhunt.policies import GreedyPolicy
env = gridhunt.make("GridHunt-ClassicStag-v0")
session = HumanSession(
env,
humans={"predator_0": ARROW_KEYS}, # the participant plays this hunter
teammates={"predator_1": GreedyPolicy()}, # an AI teammate plays the other
log=SessionLog("hat_logs", participant="P01"),
)
with session:
for round_ in range(3):
session.run_episode(seed=round_, max_steps=60)
session.ask(Questionnaire([Likert("trust", "I trusted my AI teammate.")]))
Teammates can also be the trained benchmark agents, which run on numpy alone (no PyTorch):
from gridhunt import zoo
team = zoo.load("toxic_stag", "mappo", rank="best") # downloaded once, then cached
env = team.make_env() # the scenario as it was trained
session = HumanSession(env, humans={"predator_0": ARROW_KEYS},
teammates={"predator_1": team, "predator_2": team})
examples/hitl_play_with_ai.py is a complete version, and
examples/hotl_policy_delegation.py is a human-on-the-loop
study in which the participant chooses which AI team plays from cues only they can see. Both run
headless with --dry-run.
Scenarios
| Environment | Grid | Agents | Challenge |
|---|---|---|---|
GridHunt-ClassicStag-v0 |
5×5 | 2 | Stag hunt: coordinate on the stag or settle for hares |
GridHunt-ToxicStag-v0 |
7×7 | 3 | Only one predator can tell whether the stag is toxic |
GridHunt-Specialists-v0 |
10×10 | 2 | A fast scout with full vision and a strong but short-sighted bruiser |
GridHunt-Military-v0 |
10×10 | 2 | A UAV that can only scout guides a slow ground vehicle through terrain |
GridHunt-Raid-v0 |
12×12 | 3 | Targets of rising value need more raiders and may be trapped |
GridHunt-PigChase-v0 |
9×9 | 2 | Two predators must reach the pig together through a maze |
GridHunt-LandAndSea-v0 |
10×10 | 2 | A boat and a land unit, each confined to its terrain |
GridHunt-Swarm-v0 |
23×23 | 10 | Ten predators, three stags and five hares; crowding onto a hare costs points |
Repository layout
| Path | Contents |
|---|---|
src/gridhunt/ |
The installable package |
benchmark/ |
Benchmark protocol, IPPO/MAPPO/HAPPO baselines, analysis and results (not installed) |
tests/ |
Library tests |
examples/ |
Runnable examples |
docs/ |
Documentation site sources (mkdocs serve to preview) |
Citing
If you use GridHunt, please cite it; see CITATION.cff.
License
Metadata
Release files for gridhunt 1.0.0rc2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gridhunt-1.0.0rc2.tar.gz | 523.1 kB | With provenance | Details for gridhunt-1.0.0rc2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gridhunt-1.0.0rc2-py3-none-any.whl | Python 3 | none | any | Details for gridhunt-1.0.0rc2-py3-none-any.whl |
Total release size: 927.5 kB
Release files / gridhunt-1.0.0rc2.tar.gz
| Download URL | gridhunt-1.0.0rc2.tar.gz |
|---|---|
| Size | 523.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f72a8c8a6b967fe275fd2812363dfb9424cf1fe1236661f9b032ca700da31cad
|
|
BLAKE2b-256 checksum How to use checksums |
52873a05f30895579dd8f49363afab2906d57604d4d3994bc67f9d1a4b28590d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / gridhunt-1.0.0rc2-py3-none-any.whl
| Download URL | gridhunt-1.0.0rc2-py3-none-any.whl |
|---|---|
| Size | 404.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59cc8f70fcf959e826850dc35e0f63871e3132119648843c0c8533bf6423c51d
|
|
BLAKE2b-256 checksum How to use checksums |
e8badb24b4d422f04aae254c5959ce43b3ac9f1c90801f5b849343ec040bb592
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logSecurity for gridhunt 1.0.0rc2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for gridhunt-1.0.0rc2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.