Skip to main content

BravoRL

A modular, SOTA reinforcement learning framework built on PyTorch and Hydra, driven entirely by declarative YAML. Train any combination of algorithm, network architecture, and environment without writing code:

bravorl train --config /path/to/config.yaml runner.agent.learning_rate=0.0001

Installation

pip install -e .
# optional extras
pip install -e ".[wandb]"       # Weights & Biases logging
pip install -e ".[tensorboard]" # TensorBoard logging
pip install -e ".[mujoco]"      # MuJoCo continuous-control environments

Quickstart

Two ready-to-run configs live in configs/:

# Discrete control, CPU, ~seconds: PPO on CartPole-v1
bravorl train --config configs/ppo_cartpole.yaml

# Continuous control PPO on HalfCheetah-v4 (needs the [mujoco] extra)
bravorl train --config configs/ppo_halfcheetah.yaml runner.device=cpu

Config files may live anywhere on disk -- they don't need to be inside the package. Any positional argument after --config is a Hydra dotlist override addressed by its path in the config (e.g. runner.total_timesteps=500000, runner.agent.clip_epsilon=0.1).

Architecture

bravorl/
├── cli.py          # argparse <-> Hydra bridge (hydra.initialize_config_dir)
├── runner.py        # Trainer: instantiation + the env interaction loop
├── core/
│   ├── interfaces.py # cross-cutting ABCs (BaseLogger) and shared types
│   └── registry.py   # optional name -> class registries
├── algorithms/
│   ├── base.py       # BaseAlgorithm ABC
│   └── ppo.py         # PPO: GAE, clipped surrogate, clipped value loss
├── networks/
│   ├── base.py        # BaseNetwork ABC + shape-inference helpers
│   ├── mlp.py          # ActorCriticMLP (vector observations)
│   └── cnn.py           # ActorCriticCNN (image observations)
├── buffers/
│   ├── base.py          # BaseBuffer ABC
│   └── replay_buffer.py  # StandardReplayBuffer (on- and off-policy)
├── envs/
│   └── wrappers.py        # NormalizeObservation, ClipAction, RewardScaling, ...
└── utils/
    └── logger.py           # TensorBoardLogger, WandbLogger

Every component is instantiated from config via Hydra's _target_ mechanism -- there is no hardcoded registry lookup and no if env_id == "..." branching anywhere. Network input/output shapes are always inferred at runtime from env.observation_space / env.action_space.

The network-shaping problem, and how BravoRL solves it

A network needs to know the environment's observation/action shapes before it can be built, but a naive recursive Hydra instantiation would try to build agent.network before the environment even exists. Trainer sidesteps this by being instantiated with _recursive_=False (see cli.py) and then doing the instantiation itself, in the right order:

  1. env = instantiate(cfg.env)
  2. network = instantiate(cfg.agent.network, obs_space=env.observation_space, action_space=env.action_space)
  3. agent = instantiate(cfg.agent, network=network) -- the explicit network= kwarg overrides the (still un-instantiated) network: key in the config.

Extending BravoRL

  • New algorithm: subclass bravorl.algorithms.base.BaseAlgorithm, implement select_action, compute_loss and update. Set on_policy = True if your algorithm must consume rollouts in collection order (like PPO); leave it False for off-policy algorithms sampled randomly from a replay buffer.
  • New network: subclass bravorl.networks.base.BaseNetwork, implement forward and get_action_distribution.
  • New buffer: subclass bravorl.buffers.base.BaseBuffer, implement push, sample and __len__.

Point any config's _target_ at your new class's dotted path -- no other code needs to change.

Non-functional notes

  • Fully type-hinted, mypy-compliant.
  • Google-style docstrings throughout.
  • pytest tests/ runs a fast CPU smoke test that trains PPO on CartPole-v1 for a handful of steps end-to-end.

Metadata

Release files for bravorl 0.1.0

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

Source distribution (sdist)

Source distribution for bravorl 0.1.0
File Size Uploaded Provenance Actions
bravorl-0.1.0.tar.gz 23.9 kB With provenance Details for bravorl-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bravorl 0.1.0
File Interpreter ABI Platform Actions
bravorl-0.1.0-py3-none-any.whl Python 3 none any Details for bravorl-0.1.0-py3-none-any.whl

Total release size: 50.4 kB

Release files / bravorl-0.1.0.tar.gz

Download URL bravorl-0.1.0.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
be3b45898e5e8039c82e8116703f91b10388aa614008b7fbcbedb776db022ef3
BLAKE2b-256 checksum
How to use checksums
a29283e7eb341187791b9e0b09129df672f08be2c3a388249538c7c26bed0994
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 28, 2026.

Transparency log

Release files / bravorl-0.1.0-py3-none-any.whl

Download URL bravorl-0.1.0-py3-none-any.whl
Size 26.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c446b596b8485aad3580636b57acd3612939ab5935fe6456f880ff6a27b2aee1
BLAKE2b-256 checksum
How to use checksums
ee22d3f876471e70ea2656ed5ad0060206dc1c2795dfaa63925c42271bbb507e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 28, 2026.

Transparency log

Security for bravorl 0.1.0

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 bravorl-0.1.0.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 Aug 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

0.1.0 This release

2 release files Full provenance

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