A JAX-native environment interface with powerful wrappers and adapters for popular RL environment suites
Project description
💌 Envelope: a JAX-native environment interface
# Create environments from JAX-native suites you have installed, ...
env = envelope.create("gymnax::CartPole-v1")
# ... interact with the environments using a simple interface, ...
state, info = env.init(key)
states, infos = jax.lax.scan(env.step, state, actions)
plt.plot(infos.reward.cumsum())
# ... and enjoy a powerful ecosystem of wrappers.
env = envelope.wrappers.AutoResetWrapper(env)
env = envelope.wrappers.VmapWrapper(env)
env = envelope.wrappers.ObservationNormalizationWrapper(env)
🌍 Simple, expressive interaction!
- Environments are pytrees. Squish them through JAX transformations and trace their parameters.
- Idiomatic jax-y interface of
init(key: Key) -> State, Infoandstep(state: State, action: PyTree) -> State, Info. You can directlyjax.scanover astep(...)! - Spaces are super simple. No
Tuple,Dictnonsense! There are two spaces:ContinuousandDiscrete, which you can compose into aPyTreeSpace. - Explicit episode truncation supports correctly handling bootstrapping for value-function targets.
- No auto-reset by default. Resetting every step can be expensive!
💪 Powerful, composable wrappers!
- Carry state across episodes to track running statistics, for example to normalize observations.
- Composable wrappers can be stacked in any order. For example,
ObservationNormalizationWrapperbefore vs. afterVmapWrappergives per-env vs. global normalization.
🔌 Adapters for existing suites
| 📦 | # 🤖 | # 🌍 |
|---|---|---|
| gymnax | 🕺 | 24 |
| brax | 🕺 | 12 |
| jumanji | 🕺 / 👯 | 25 / 1 |
| kinetix | 🕺 | 74 |
| craftax | 🕺 | 4 |
| mujoco_playground | 🕺 | 54 |
| Total | 🕺 / 👯 | 193 / 1 |
envelope.create("📦::🌍")
let's you create environments from any of the above!
📝 Testing
- Default (no optional compat deps required):
uv run pytest -m "not compat" - Compat suite (requires full compat dependency group):
uv sync --group compatuv run pytest -m compat- If any compat dependency is missing/broken, the run will fail fast with an error telling you what to install.
🏗️ Installation
pip install jax-envelope
💞 Related projects
- stoa is a very similar project that provides adapters and wrappers for the jumanji-like interface.
- Check out all the great suites we have adapters for! gymnax, brax, jumanji, kinetix, craftax, mujoco_playground.
- We will be adding support for jaxmarl and pgx in the future, as soon as we figured out the best ever MARL interface for JAX!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jax_envelope-0.3.0.tar.gz.
File metadata
- Download URL: jax_envelope-0.3.0.tar.gz
- Upload date:
- Size: 221.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c895f54c119a671f617114df5741d64c9afae01a8c1783197a293042e5d38ea
|
|
| MD5 |
ddf0a67629c0f1ee52bee3d0fbe1008a
|
|
| BLAKE2b-256 |
5e0c9d2a4522a41d9ed489992d89911e0211c3cf7a51903c39a58375e5243622
|
Provenance
The following attestation bundles were made for jax_envelope-0.3.0.tar.gz:
Publisher:
publish.yml on keraJLi/envelope
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jax_envelope-0.3.0.tar.gz -
Subject digest:
3c895f54c119a671f617114df5741d64c9afae01a8c1783197a293042e5d38ea - Sigstore transparency entry: 921512450
- Sigstore integration time:
-
Permalink:
keraJLi/envelope@9f46611c6ca61e59f8612b82f6142351cd88b0e4 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/keraJLi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9f46611c6ca61e59f8612b82f6142351cd88b0e4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file jax_envelope-0.3.0-py3-none-any.whl.
File metadata
- Download URL: jax_envelope-0.3.0-py3-none-any.whl
- Upload date:
- Size: 36.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be9ac797bf295c00745eeecefa80c53a47639776e2f0689fc20a1b605f0b2a2c
|
|
| MD5 |
bbe3156e489856bc1d2a7d446c81b48f
|
|
| BLAKE2b-256 |
52bb95e6bd4d12f31f19b160760d4237bb9175e01f48dd6c9ebbd24769a903b8
|
Provenance
The following attestation bundles were made for jax_envelope-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on keraJLi/envelope
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jax_envelope-0.3.0-py3-none-any.whl -
Subject digest:
be9ac797bf295c00745eeecefa80c53a47639776e2f0689fc20a1b605f0b2a2c - Sigstore transparency entry: 921512486
- Sigstore integration time:
-
Permalink:
keraJLi/envelope@9f46611c6ca61e59f8612b82f6142351cd88b0e4 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/keraJLi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9f46611c6ca61e59f8612b82f6142351cd88b0e4 -
Trigger Event:
release
-
Statement type: