Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Perpetua

Perpetua is a JAX library of never-ending, changing worlds for reinforcement learning research, and the tools to study agents that keep learning in them. It is for researchers working on continual RL, non-stationarity, plasticity and continual multi-agent RL, and for developers who want to add such worlds.

Most RL training assumes a fixed task split into episodes. Perpetua changes three things:

  • One lifetime, no resets. init once, step forever. A death or a reached goal is a respawn reported in info["respawn"], not the end of an episode.
  • Drift. The world changes through parameters that move over time (a goal, gravity, a partner's behaviour), set with drift= when the environment is made. What drifts depends on the environment family.
  • Privilege is opt-in. The agent is not told when the world changed. An Oracle can expose that, and the choice is recorded with the results.

Status: pre-release. Not on PyPI yet (the name perpetua-rl is provisional). Perpetua is released under the MIT licence.

Install

Python 3.12 or 3.13 and uv.

git clone https://github.com/Skyfall-Research/perpetua.git
cd perpetua
uv sync --locked --extra training   # core + the PPO/DQN/SAC learners
uv run python -c "import perpetua as pp; pp.testing.check_env(lambda: pp.make('ContinualGrid-v0')); print('ok')"

On macOS this needs Apple Silicon and an arm64 Python, because JAX publishes no Intel macOS wheels: if uv sync reports that jaxlib has no wheel for the platform, run uv python install cpython-3.12-macos-aarch64-none and add --python cpython-3.12-macos-aarch64-none to the uv sync line. macOS is checked by hand; CI runs on Linux only.

Other environments and backends are optional extras (interop for gymnax, marl for PettingZoo, cuda13 for NVIDIA GPUs on Linux, ...); see installation.

A first lifetime

import perpetua as pp

# The goal alternates between two corners every 127 ticks (environment steps).
env = pp.make("ContinualGrid-v0", size=8, drift=pp.drift.Cyclic([(7, 7), (0, 0)], 127))
runner = pp.runtime.Runner(env, pp.policies.random, ticks=1024)  # 1,024 ticks, compiled
carry = runner(pp.runtime.init_lifetime(env, seed=0))
# [0]: agent slot 0. Metrics have a leading agent axis, even with one agent.
print(carry.state.t.to_int(), float(carry.metrics.mean[0]))  # ticks so far, mean reward

This prints 1024 and the random policy's mean reward per tick, about 0.005: random moves rarely find the goal. The quickstart trains PPO through goal switches and measures recovery and forgetting, in about five seconds on a laptop CPU.

Coming from Gymnasium or PettingZoo

Gymnasium Perpetua
obs, info = env.reset(seed=s) state, obs, info = env.init(key), once per lifetime
obs, r, terminated, truncated, info = env.step(a) state, obs, reward, info = env.step(state, action, key), a pure function
terminated / truncated info["respawn"]; the lifetime continues

Perpetua for Gymnasium users covers porting a training loop, seeding, wrappers and PettingZoo's parallel and AEC APIs.

What's included

  • 53 environments in six families: native continual worlds, multi-agent worlds, gymnax and MuJoCo MJX control, MinAtar and bsuite, the continual benchmarks MEAL, Continual World, COOM, AgarCL and MORPHEUS, and an EnvPool CPU bridge. See the environments.
  • Drift and task switching: cyclic, random-walk, procedural and agent-driven drift, per-lifetime schedules, and several environments in one lifetime. See lifetimes and drift and task switching.
  • Learners: continuing PPO/IPPO, DQN/IQL and SAC in JAX, plus a PyTorch bridge. See training.
  • Measurement: streaming lifetime metrics, recovery, forgetting, regret, plasticity probes and IQM reporting. See evaluation.
  • Checkpoints: atomic full-state checkpoints (world, drift, keys, metrics, learner) and exact segment replay.
  • Adapters: Gymnasium, PettingZoo and gymnax environments in, and Perpetua environments out to Gymnasium and PettingZoo tools. See adapters and multi-agent.
  • Writing your own environment: a four-step tutorial and the pp.testing.check_env contract checker.

Performance

On one NVIDIA H200 GPU, PPO on the JAX-native CartPole lifetime processes 21× as many environment steps per second as PyTorch PPO on one Gymnasium AsyncVectorEnv worker. With 128 lifetimes trained side by side under jax.vmap it processes 41–49× as many as that baseline with 128 workers (the range spans two measurements). This compares throughput: the 128 lifetimes are 128 independent learners, and the baseline is one learner with 128 environments. See measured claims for the setup, the other claims and their limits.

Documentation

The docs are a Sphinx site built from docs/; see contributing to build them.

Slides

Perpetua: A Standard Interface for Continual Reinforcement Learning (PDF, 24 pages) is the proposal talk from September 2026: why continual RL needs its own interface, a survey of existing frameworks and benchmarks, the design principles, and the planned measurements. It was written before the library existed in its current form, so its API sketch, roadmap and "claims we will measure" are intentions, not results. The documentation and measured claims describe what Perpetua does today.

Contributing

See CONTRIBUTING.md for the engineering rules and the checks every change runs.

Acknowledgements and citation

Perpetua builds on other people's work, and we are grateful to the authors. The PPO learner is adapted from PureJaxRL (Lu et al.). The environments, interfaces and benchmarks Perpetua wraps or reproduces come from Gymnasium, PettingZoo, MPE2, gymnax (with its JAX versions of MinAtar and bsuite tasks), JaxMARL, Meta-World and the Continual World benchmark, COOM and ViZDoom, MEAL, AgarCL, EnvPool, MuJoCo and MJX and the MORPHEUS evaluation suite. BeanWorld-v0 is an original implementation in the style of Jelly Bean World. These are optional dependencies and are not vendored; each keeps its own licence, listed in THIRD_PARTY_NOTICES.md. If you use Perpetua, please cite it and the benchmarks you run; how to cite has the BibTeX and the list of papers.

Licence

Perpetua is released under the MIT licence.

Metadata

Release files for perpetua-rl 0.0.1a0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for perpetua-rl 0.0.1a0
File Size Uploaded Provenance Actions
perpetua_rl-0.0.1a0.tar.gz 1.1 MB With provenance Details for perpetua_rl-0.0.1a0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for perpetua-rl 0.0.1a0
File Interpreter ABI Platform Actions
perpetua_rl-0.0.1a0-py3-none-any.whl Python 3 none any Details for perpetua_rl-0.0.1a0-py3-none-any.whl

Total release size: 1.4 MB

Release files / perpetua_rl-0.0.1a0.tar.gz

Download URL perpetua_rl-0.0.1a0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
15f7229f14ac503baa460d39c5b5b00d0e156ae8260fac71b43a125485a2ee0d
BLAKE2b-256 checksum
How to use checksums
683df6db4eb56b052e4f627ba63c1862e20c0c8de838a9364d50e6f96608bb50
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 28, 2026.

Transparency log

Release files / perpetua_rl-0.0.1a0-py3-none-any.whl

Download URL perpetua_rl-0.0.1a0-py3-none-any.whl
Size 286.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f47d204767094e88431074127d637dd78a42da32988ce11420d83df1b6c6ac32
BLAKE2b-256 checksum
How to use checksums
b1f15885441143c23b26f7c32ed3d68469754caaf4de65d8d32d8fdc270b979d
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 28, 2026.

Transparency log

Security for perpetua-rl 0.0.1a0

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.

Select from 2 files

Attestation for perpetua_rl-0.0.1a0.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 28, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page