Practical overview
When it fits
Use Pgx when an RL experiment needs JAX-native environments for discrete-state games and benefits from vectorized parallel simulation.
Who it is for
- Researchers developing reinforcement-learning systems for discrete-state games.
- Developers who need batched game environments for policy training or evaluation.
- Teams using JAX or PettingZoo-compatible game workflows.
Documented uses
- Run parallel instances of supported games as RL environments.
- Train agents using the repository’s AlphaZero or PPO examples.
- Evaluate policies across repeated game episodes.
- Convert Pgx environments to PettingZoo’s AEC API.
Requirements & limits
The project is available on PyPI and its repository identifies an Apache-2.0 license. The README specifies Python 3.9 or newer and requires JAX and jaxlib, with their installation depending on hardware.
- JAX and jaxlib are prerequisites; the appropriate setup depends on hardware.
- The repository describes GPU acceleration but does not specify one universal hardware configuration.
- Pgx provides environments rather than the policy model that selects actions.
- The README includes AlphaZero and PPO training examples and a PettingZoo conversion demonstration.
- For stochastic environments, API v2 allows an explicit random key in the step call; Go and chess are identified as deterministic examples unaffected by that change.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install Pgx and initialize a batched Go environment
Set up Pgx and initialize vectorized Go game states for reinforcement-learning use.
Before you start
- Python 3.9 or later.
- JAX and jaxlib installed according to the hardware specification.
Steps
Install Pgx with the command below.
pip install pgxImport
jaxandpgx, then create the environment withenv = pgx.make("go_19x19").Create JIT-compiled vectorized initialization with
init = jax.jit(jax.vmap(env.init)).Create 1,024 PRNG keys using
jax.random.split(jax.random.PRNGKey(42), 1024)and initialize batched states withstate = init(keys).
Expected outcome
A batch of initialized Go states ready for a policy to act on.
Guide limitations
- The documented usage requires JAX and jaxlib; installation details depend on hardware.
- This recipe initializes states only; the example's later action-selection step requires a
modelthat is not defined in the documented snippet.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 14 October 2026
- Original website title
- sotetsuk/pgx · Official homepage title · retained in its source language

