Skip to main content
Pre-release

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

veery — a Validation Environment for Exposing RiskY models

veery is a Python library for falsifying controllers, especially reinforcement-learning (RL) controllers. Given a controlled system and a specification, it searches for disturbance sequences (sensor noise, actuator noise, and environment perturbations) that cause a system violate its specifications by some threshold value.

In addition to naive sampling, veery provides a targeted search for more likely failures using Monte Carlo Tree Search (MCTS).

The main case study is an RL controller for the Holos-Quad microreactor (based on the model from Tunkle et al., 2025). We include a simpler inverted pendulum example for demonstration purposes. The falsification framework defined in this repo is based on that defined in Algorithms for Validation by Kochenderfer et al..

Status: early alpha. The API may change between releases.

Installation

veery requires Python ≥3.12.

pip install veery

The example problems in experiments/ are not part of the package. To run them, clone the repository and install from source:

conda env create -f environment.yml   # creates the `veery` env (Python 3.12)
conda activate veery

or, in an existing Python ≥3.12 environment:

pip install -e ".[dev,experiments]"

dev adds pytest; experiments adds stable-baselines3, tensorboard, and gymnasium for the example problems.

Quick start

See pendulum_tutorial.ipynb for a full walkthrough on a simple demo problem.

Defining a problem

veery is problem-agnostic. To use it, you supply an environment, a model (controller), and a disturbance distribution.

Environment

Member Purpose
profile(time) Desired value of the controlled variable at time
state Current state, passed to DisturbanceDistribution.sample()
reset() Reset to the initial condition
step(action, disturbance) Advance one step under an explicit Disturbance; returns a gym-style (obs, reward, terminated, truncated, info)
get_snapshot() / set_snapshot(snap) Save/restore full state. The snapshot dict must include "time", "runtime", and "observation"
rollout_from_snapshot(model, snap, disturbance_distribution) Roll out to the end of the episode from snap; returns (actual, desired) lists
state_robustness(threshold, percent=True) Robustness margin at the current step

percent=True treats threshold as a fractional deviation from the profile. Use percent=False (a flat deviation) when the profile can be 0. Pass the same value to run_MCTS, check_spec, and plot_tree.

If you want to use check_spec or the rollout plots, also log a history DataFrame with Actual and Desired columns. Both examples organize this with _get_observation(xo) and _log_history(...) helpers.

Model

Any object with an SB3-style predict(observation, deterministic=True) that returns (action, state). We demonstrate a simpler model via a proportional controller for the Inverted Pendulum system (see PendulumController).

Disturbances

DisturbanceDistribution          → sample() returns Disturbance(xo, xa, xs)
 ├─ Do: ComponentDistribution    → observation (sensor) disturbances, xo = {name: value}
 ├─ Da: ComponentDistribution    → agent (action) disturbances, xa
 └─ Ds: ComponentDistribution    → state (environment) disturbances, xs
      └─ {name: DisturbedVariable(distribution, size)}

Define each component's disturbance distribution by subclassing ComponentDistribution. For example, we can write the observation disturbance distribution for the HolosQuad sensors as:

from veery.fuzzing import ComponentDistribution, DisturbedVariable, gaussian

class Do(ComponentDistribution):
    def __init__(self, sigma_p=0.01, sigma_drum=0.005):
        super().__init__({
            "p": DisturbedVariable(gaussian(sigma_p)),
            "drum_angles": DisturbedVariable(gaussian(sigma_drum), size=8),
        })

gaussian(0) returns a ZeroDist, so a zero-sigma component samples zeros and has a "dummy" log-likelihood value of 0. To check a distribution, you can call D.plot_samples(D.Do, "p"). If a disturbance depends on state or action, you can override sample() in your subclass to accept those conditional values.

Running MCTS

run_MCTS(environment, model, disturbance_dist, results_path, threshold, iterations=100, hyperparams=None, percent=True)

Hyperparameter Meaning Default
c Exploration constant (lower confidence bound) 0.5
k, alpha Progressive widening: a node expands while children ≤ k·N^alpha 1, 0.25
lambda Weight on disturbance log-likelihood in the node score 0.01

The node score is the mean rollout robustness (rho) minus λ·log-likelihood of the path disturbances. This MCTS minimizes the scoring function, therefore searching for trajectories that are both close to failure and likely.

Outputs written to results_path:

  • tree.pkl: the full search tree (list of Nodes)
  • failures.csv: failures ranked by mean log-likelihood along the path
  • failure_sequences.pkl: the disturbance and action sequence (trajectories) for each failure

Plotting (veery.viz): plot_tree, plot_tree_structure, plot_rollouts, plot_overlapping_rollouts, plot_robustness.

Examples

  • experiments/holos/: Holos-Quad microreactor. Gym environment (HolosMulti), point-kinetics model, power profiles, and SB3 training (python train.py). Demo in holos_tutorial.ipynb.
  • experiments/inverted_pendulum/: inverted pendulum with a proportional controller. Demo in pendulum_tutorial.ipynb.

Experiments should be run from inside their own folder to properly manage imports.

Repository layout

src/veery/
  fuzzing.py      # disturbance classes
  mcts.py         # MCTS, failure ranking and saving
  accessories.py  # check_spec (ψ), robustness (ρ)
  viz.py          # plotting
experiments/      # problem-specific code (not part of the package)
tests/            # pytest suite

Testing

pytest

References

If you use veery, please cite it using CITATION.cff.

License

MIT

Metadata

Release files for veery 0.1.0a1

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

Source distribution (sdist)

Source distribution for veery 0.1.0a1
File Size Uploaded Provenance Actions
veery-0.1.0a1.tar.gz 19.1 kB With provenance Details for veery-0.1.0a1.tar.gz

Built distribution (wheel)

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

Total release size: 35.9 kB

Release files / veery-0.1.0a1.tar.gz

Download URL veery-0.1.0a1.tar.gz
Size 19.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f0066a5062a1bd59b6c57921b32ace2d5ad31bed53617f5dbcc9b7005b13cad6
BLAKE2b-256 checksum
How to use checksums
82091a46863748ad1e7e64bf6b8211690156bf9720fc1c889314073c5532bd10
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 16, 2026.

Transparency log

Release files / veery-0.1.0a1-py3-none-any.whl

Download URL veery-0.1.0a1-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8863e30186de6b0f21ea7a116f670ec651f9eb4fd9b72d3b5c66d435a1e5b7dd
BLAKE2b-256 checksum
How to use checksums
7c9881da09c5f5481c06b1864eca42a33819bf2c62e52d15094f123499cc44c5
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 16, 2026.

Transparency log

Security for veery 0.1.0a1

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 veery-0.1.0a1.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 16, 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