Skip to main content

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.reset(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 reset(key: Key) -> State, Info and step(state: State, action: PyTree) -> State, Info. You can directly jax.scan over a step(...)!
  • Spaces are super simple. No Tuple, Dict nonsense! There are two spaces: Continuous and Discrete, which you can compose into a PyTreeSpace.
  • 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, ObservationNormalizationWrapper before vs. after VmapWrapper gives 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 compat
    • uv 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

  • stoax 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

jax_envelope-0.1.0.tar.gz (200.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jax_envelope-0.1.0-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file jax_envelope-0.1.0.tar.gz.

File metadata

  • Download URL: jax_envelope-0.1.0.tar.gz
  • Upload date:
  • Size: 200.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jax_envelope-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d10c161bb9f01403bbda6d8ce81c6a3c4574682649566595c41e00864cb62479
MD5 ff72f4cbf27945eefd4dbbc67b864d8c
BLAKE2b-256 97380b02d871014d98c4f876d9aad3beba27996b8107e219ac2dc1a3f1ea9da1

See more details on using hashes here.

Provenance

The following attestation bundles were made for jax_envelope-0.1.0.tar.gz:

Publisher: publish.yml on keraJLi/envelope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jax_envelope-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jax_envelope-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jax_envelope-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e42c1b5c296d02c7c8d761b0191cddba0dd21559bac5271887e142f54f22adc
MD5 57bb48d5a3d227ec8431e8b5bbb355a2
BLAKE2b-256 3693e1ea91862babf79917b7746cec6939c767f79f644cdde178ca07fc7ed502

See more details on using hashes here.

Provenance

The following attestation bundles were made for jax_envelope-0.1.0-py3-none-any.whl:

Publisher: publish.yml on keraJLi/envelope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page