Time Robustness Audit for RL agents — measures timing reliance, deployment robustness, and stress resilience
Project description
deltatau-audit
Time Robustness Audit for RL agents.
Evaluates whether an RL agent breaks when the environment's timing changes — the kind of failure that silently appears in deployment but never shows up in training.
Install
pip install deltatau-audit[demo]
Quick Start
# Run the bundled CartPole demo (Before/After comparison)
python -m deltatau_audit demo cartpole --out demo_report/
Open demo_report/baseline/index.html and demo_report/robust_wide/index.html to see the Before/After reports.
What It Measures
| Badge | What it tests | How |
|---|---|---|
| Reliance | Does the agent use internal timing? | Tampers with internal Δτ, measures value prediction error |
| Deployment | Does the agent survive realistic timing changes? | Jitter, observation delay, mid-episode speed spikes |
| Stress | Does the agent survive extreme timing changes? | 5× speed (unseen during training) |
Agents without internal timing (standard GRU, SB3 models, etc.) get Reliance: N/A — only Deployment and Stress are tested.
Rating Scale
| Rating | Return Ratio | Meaning |
|---|---|---|
| PASS | > 95% | Production ready |
| MILD | > 80% | Minor degradation |
| DEGRADED | > 50% | Significant loss |
| FAIL | ≤ 50% | Agent breaks |
CI Mode
python -m deltatau_audit demo cartpole --ci --out ci_report/
# exit 0 = pass, exit 1 = warn (stress), exit 2 = fail (deployment)
Outputs ci_summary.json and ci_summary.md for pipeline gates and PR comments.
Audit Your Own Model
Implement AgentAdapter (see deltatau_audit/adapters/base.py):
from deltatau_audit.adapters.base import AgentAdapter
class MyAdapter(AgentAdapter):
def reset_hidden(self, batch=1, device="cpu"):
return torch.zeros(batch, hidden_dim)
def act(self, obs, hidden):
# Returns: (action, value, hidden_new, dt_or_None)
...
return action, value, hidden_new, None
Then audit:
from deltatau_audit.auditor import run_full_audit
from deltatau_audit.report import generate_report
result = run_full_audit(adapter, env_factory, speeds=[1,2,3,5,8], n_episodes=30)
generate_report(result, "my_report/", title="My Agent Audit")
Audit Your Own Checkpoint
python -m deltatau_audit audit \
--checkpoint path/to/model.pt \
--agent-type internal_time \
--env chain \
--out audit_report/
SB3 RecurrentPPO
pip install deltatau-audit[sb3]
from sb3_contrib import RecurrentPPO
from deltatau_audit.adapters.sb3_recurrent import SB3RecurrentAdapter
from deltatau_audit.auditor import run_full_audit
from deltatau_audit.report import generate_report
import gymnasium as gym
model = RecurrentPPO.load("my_model.zip")
adapter = SB3RecurrentAdapter(model)
result = run_full_audit(
adapter,
lambda: gym.make("CartPole-v1"),
speeds=[1, 2, 3, 5, 8],
n_episodes=30,
)
generate_report(result, "sb3_audit/", title="SB3 RecurrentPPO Audit")
Comparing Results
python -m deltatau_audit diff before/summary.json after/summary.json --out comparison.md
The demo subcommand also auto-generates comparison.md in the output directory.
Project details
Release history Release notifications | RSS feed
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 deltatau_audit-0.3.1.tar.gz.
File metadata
- Download URL: deltatau_audit-0.3.1.tar.gz
- Upload date:
- Size: 205.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eedfc22cba28a0795d67b8f80c01afa1f0cf1581e0b4a614b2926faf20ac0d82
|
|
| MD5 |
6c47a735b5ac39bd39469c1972d72f71
|
|
| BLAKE2b-256 |
567110cbe28373f253ca95d0ef80a3fbd96541a86431d18cf2aeaa057bb12a05
|
Provenance
The following attestation bundles were made for deltatau_audit-0.3.1.tar.gz:
Publisher:
release.yml on maruyamakoju/deltatau-audit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deltatau_audit-0.3.1.tar.gz -
Subject digest:
eedfc22cba28a0795d67b8f80c01afa1f0cf1581e0b4a614b2926faf20ac0d82 - Sigstore transparency entry: 956241855
- Sigstore integration time:
-
Permalink:
maruyamakoju/deltatau-audit@1d9ba96083e51af53e5a5917dccedf69e78a69e8 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/maruyamakoju
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1d9ba96083e51af53e5a5917dccedf69e78a69e8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file deltatau_audit-0.3.1-py3-none-any.whl.
File metadata
- Download URL: deltatau_audit-0.3.1-py3-none-any.whl
- Upload date:
- Size: 204.1 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 |
fd818fbb74f3b32ac75ae6bea2c68259a8443bfcbd4ec2374b81eb644e35919a
|
|
| MD5 |
ec331f1e1de4d7c3013bfb7f1c0dfad7
|
|
| BLAKE2b-256 |
fd8b7a92f370db6c56179b94e17b8a17dbd819aa1736646e888fb171448f3cf8
|
Provenance
The following attestation bundles were made for deltatau_audit-0.3.1-py3-none-any.whl:
Publisher:
release.yml on maruyamakoju/deltatau-audit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deltatau_audit-0.3.1-py3-none-any.whl -
Subject digest:
fd818fbb74f3b32ac75ae6bea2c68259a8443bfcbd4ec2374b81eb644e35919a - Sigstore transparency entry: 956241858
- Sigstore integration time:
-
Permalink:
maruyamakoju/deltatau-audit@1d9ba96083e51af53e5a5917dccedf69e78a69e8 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/maruyamakoju
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1d9ba96083e51af53e5a5917dccedf69e78a69e8 -
Trigger Event:
push
-
Statement type: