A JAX-Native Interface for Reinforcement Learning Environments
🚀 Welcome to Stoa
Stoa provides a lightweight, JAX-native interface for reinforcement learning environments. It defines a common abstraction layer that enables different environment libraries to work together seamlessly in JAX workflows.
⚠️ Early Development – Core abstractions are in place, but the library is still growing!
🎯 What Stoa Provides
- Common Interface: A standardized
Environmentbase class that defines the contract for RL environments in JAX. - JAX-Native Design: Pure-functional
stepandresetoperations compatible with JAX transformations likejitandvmap. - Environment Wrappers: A flexible system for composing and extending environments with additional functionality.
- Space Definitions: Structured representations for observation, action, and state spaces.
- TimeStep Protocol: A standardized
TimeStepstructure to represent environment transitions with clear termination and truncation signals.
🛠️ Installation
You can install the core stoa library via pip:
pip install stoa-env
This minimal installation includes the core API and wrappers but no specific environment adapters.
Environment Adapters
Adapters for external environment libraries are available as optional extras. You can install them individually or all at once.
Install a specific adapter:
# Example for Gymnax
pip install "stoa-env[gymnax]"
# Example for Brax
pip install "stoa-env[brax]"
Install all available adapters:
pip install "stoa-env[all]"
🧩 Available Adapters
Stoa currently supports the following JAX-native environment libraries:
- Brax
- Gymnax
- Jumanji
- Kinetix
- Navix
- PGX (Game environments)
- MuJoCo Playground
- XMinigrid
✨ Available Wrappers
Stoa provides a rich set of wrappers to modify and extend environment behavior:
- Core Wrappers:
AutoResetWrapper,RecordEpisodeMetrics,AddRNGKey,VmapWrapper. - Observation Wrappers:
FlattenObservationWrapper,FrameStackingWrapper,ObservationExtractWrapper,AddActionMaskWrapper,AddStartFlagAndPrevAction,AddStepCountWrapper,MakeChannelLast,ObservationTypeWrapper. - Action Space Wrappers:
MultiDiscreteToDiscreteWrapper,MultiBoundedToBoundedWrapper. - Utility Wrappers:
EpisodeStepLimitWrapper,ConsistentExtrasWrapper.
⚡ Usage Example
Here's how to adapt a gymnax environment and compose it with several wrappers:
import jax
import gymnax
from stoa import GymnaxToStoa, FlattenObservationWrapper, AutoResetWrapper, RecordEpisodeMetrics
# 1. Instantiate a base environment from a supported library
gymnax_env, env_params = gymnax.make("CartPole-v1")
# 2. Adapt the environment to the Stoa interface
env = GymnaxToStoa(gymnax_env, env_params)
# 3. Apply standard wrappers
# Note: The order of wrappers matters.
env = AutoResetWrapper(env, next_obs_in_extras=True)
env = RecordEpisodeMetrics(env)
# JIT compile the reset and step functions for performance
env.reset = jax.jit(env.reset)
env.step = jax.jit(env.step)
# 4. Interact with the environment
rng_key = jax.random.PRNGKey(0)
state, timestep = env.reset(rng_key)
total_reward = 0
for _ in range(100):
action = env.action_space().sample(rng_key)
state, timestep = env.step(state, action)
total_reward += timestep.reward
if timestep.last():
# Access metrics recorded by the RecordEpisodeMetrics wrapper
episode_return = timestep.extras['episode_metrics']['episode_return']
print(f"Episode finished. Return: {episode_return}")
# The state has been auto-reset, so we can continue the loop
total_reward = 0
🛣️ Roadmap
- Documentation: Expand documentation with detailed tutorials and API references.
- More Wrappers: Add more common utility wrappers (e.g., observation normalization, reward clipping).
- Integration Examples: Provide examples of how to integrate
stoawith popular JAX-based RL libraries.
🤝 Contributing
We're building Stoa to provide a common foundation for JAX-based RL research. Contributions are welcome!
📚 Related Projects
- Stoix – Distributed single-agent RL in JAX
- Gymnax – Classic control environments in JAX
- Brax – Physics-based environments in JAX
- Jumanji – Board games and optimization problems in JAX
- Navix – Grid-world environments in JAX
- PGX - Classic board and card game environments in JAX
- Kinetix - Robotics environments in JAX
Citation
If you use Stoa, please cite it!
@misc{toledo2025stoa,
author = {Edan Toledo},
title = {Stoa: A JAX-Native Interface for Reinforcement Learning Environments},
year = {2025},
url = {https://github.com/EdanToledo/Stoa}
}
Metadata
Release files for stoa-env 0.1.2
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 |
|---|---|---|---|---|
| stoa_env-0.1.2.tar.gz | 42.9 kB | With provenance | Details for stoa_env-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stoa_env-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for stoa_env-0.1.2-py3-none-any.whl |
Total release size: 98.8 kB
Release files / stoa_env-0.1.2.tar.gz
| Download URL | stoa_env-0.1.2.tar.gz |
|---|---|
| Size | 42.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8677d446d313e73465870f60e652bbdff4cf17cbf2bde81d2f9f7c3a380e4c04
|
|
BLAKE2b-256 checksum How to use checksums |
630637cfafbc39cae3ead9d448e7736477df44d48bfaae243a89f71f3a5b56c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Sep 16, 2025.
Transparency logRelease files / stoa_env-0.1.2-py3-none-any.whl
| Download URL | stoa_env-0.1.2-py3-none-any.whl |
|---|---|
| Size | 55.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3e90674d81ae66ff87c9fca06afc93f45252304600f05f121fcb5d34aef1e6c
|
|
BLAKE2b-256 checksum How to use checksums |
85ef21536ac34a24e7c6bf9e88db1b3361b40e6c3f4a140bbee895a4d9ca46f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Sep 16, 2025.
Transparency logSecurity for stoa-env 0.1.2
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for stoa_env-0.1.2.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 Sep 16, 2025.
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.