Skip to main content

anywatch

CI Docs PyPI Python License: MPL 2.0

Anytime-valid post-market monitoring for deployed AI systems.

anywatch turns post-market monitoring of AI models from a checklist into measurable statistical evidence. It tracks performance in every subgroup, raises alarms on data drift and performance degradation, and writes audit ready reports structured along Article 72 of the EU AI Act and the FDA guidance on Predetermined Change Control Plans (PCCP).

Every test in the package is anytime valid. You may look at the results after every new case, every day or whenever an auditor asks, and the error guarantees still hold. Classical tests lose their guarantees under this kind of continuous monitoring; e-values and confidence sequences do not.

Why

Regulation now asks for continuous monitoring after deployment:

  • The EU AI Act (Regulation (EU) 2024/1689, Article 72) requires providers of high-risk AI systems to actively and systematically collect, document and analyse performance data throughout the lifetime of the system.
  • The FDA expects a PCCP for AI-enabled device software functions to include performance evaluation protocols and real-world monitoring.

Most existing governance tools check documents and keywords. Few provide a statistically valid answer to the question "is the model still performing as declared, in every patient group, right now?" anywatch does.

Installation

pip install anywatch

Python 3.10 or newer is required. The only runtime dependencies are NumPy and Jinja2.

Quick start

import anywatch as aw
from anywatch.datasets import make_classification_stream

# Simulated stream: sensitivity is fine in two sites and too low in the third.
stream = make_classification_stream(
    6000,
    groups=["site_a", "site_b", "site_c"],
    prevalence=0.3,
    sensitivity={"site_a": 0.95, "site_b": 0.94, "site_c": 0.82},
    seed=1,
)

monitor = aw.SubgroupMonitor(
    metric="sensitivity",
    target=0.90,
    groups=["site_a", "site_b", "site_c"],
    alpha=0.05,  # probability of any false alarm, in any group, at any time
)

for start in range(0, len(stream), 500):  # daily batches, inspected every time
    batch = slice(start, start + 500)
    for alarm in monitor.update(stream.y_true[batch], stream.y_pred[batch], stream.group[batch]):
        print(alarm.message)

for row in monitor.status():
    print(f"{row.group}: {row.estimate:.3f} [{row.ci_lower:.3f}, {row.ci_upper:.3f}]")

Create an Article 72 report from the same monitor:

report = aw.build_art72_report(
    system=aw.SystemInfo(
        name="Chest X-ray triage",
        version="2.1.0",
        provider="Example Health Ltd",
        intended_purpose="Prioritise suspected pneumothorax for radiologist review",
    ),
    monitors=[monitor],
    plan=aw.PostMarketMonitoringPlan(
        data_sources=["Radiologist confirmed reads from deploying sites"],
        collection_frequency="Daily",
        responsible_person="Head of Clinical Safety",
    ),
    audit=aw.AuditTrail(),
)
report.save("art72_report.html")  # also .md and .json

What is inside

Module Purpose Main objects
anywatch.sequential Anytime-valid tests and confidence sequences for bounded means BettingEProcess, EmpiricalBernsteinCS, BettingCS, PairedDifferenceEProcess
anywatch.subgroups Sensitivity, specificity and error rates per subgroup with multiplicity control SubgroupMonitor, ebh, confusion_counts
anywatch.drift Data drift and performance degradation alarms QuantileDriftDetector, MeanShiftDetector, PerformanceDegradationDetector, ChangeDetector
anywatch.reporting Tamper evident audit trail and regulatory reports AuditTrail, build_art72_report, build_pccp_report
anywatch.datasets Synthetic streams for examples and power studies make_classification_stream

Guarantees

Tool Guarantee
BettingEProcess P(ever reject a true null) <= alpha, for any stopping rule
EmpiricalBernsteinCS, BettingCS P(true mean outside the interval at any time) <= alpha
SubgroupMonitor (Bonferroni) P(any false alarm in any subgroup at any time) <= alpha
SubgroupMonitor.ebh_discoveries False discovery rate <= alpha at the time of the call, under any dependence
ChangeDetector Expected time to a false alarm >= arl

All guarantees are nonasymptotic and need only that observations are bounded, which holds for every classification metric. No independence or distributional assumption beyond the null hypothesis itself is required for the betting tests.

Command line

anywatch report cases.csv --metric sensitivity --target 0.9 --group-col site \
    --system-name "Triage model" --system-version 2.1 --provider "Example Ltd" \
    --framework art72 --format html --output report.html

Documentation

Full documentation, including the theory behind e-values and confidence sequences, is at https://yunusimanov.github.io/anywatch.

Relation to other work

anywatch covers the post-deployment phase of the clinical AI lifecycle. A companion library for pre-deployment local validation and threshold selection is planned, so that the two together cover the full lifecycle.

Citing

If you use anywatch in academic work, please cite it using the metadata in CITATION.cff or the "Cite this repository" button on GitHub.

Contributing

Contributions are welcome. Please read CONTRIBUTING.md and the Code of Conduct.

License

anywatch is distributed under the Mozilla Public License 2.0.

Author

Yunus Imanov, Researcher, Department of Engineering Mathematics and Artificial Intelligence, Azerbaijan Technical University, Baku, Azerbaijan. Contact: yunus.imanov.fz@student.aztu.edu.az

Disclaimer

anywatch produces statistical evidence to support post-market documentation. It does not by itself establish regulatory compliance.

Metadata

Release files for anywatch 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 anywatch 0.1.0
File Size Uploaded Provenance Actions
anywatch-0.1.0.tar.gz 57.6 kB With provenance Details for anywatch-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 120.3 kB

Release files / anywatch-0.1.0.tar.gz

Download URL anywatch-0.1.0.tar.gz
Size 57.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7caa96432c1164357f036432685693ff50d5a447cd703288d5ac3c37c2bfdb20
BLAKE2b-256 checksum
How to use checksums
6300c0faf2961de99cccc59ef68add39b2c652326ed434e0adbe824a0b1db6ba
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 Dec 4, 2026.

Transparency log

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

Download URL anywatch-0.1.0-py3-none-any.whl
Size 62.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96839667bc1313af0073be29dadcf931902ac62d46f1205df3d50f11ab56360e
BLAKE2b-256 checksum
How to use checksums
281573edf2ada8c72b82c6e5b952a371234a2d2dfc7cc1f64a88c3586acc7e97
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 Dec 4, 2026.

Transparency log

Security for anywatch 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 anywatch-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 Dec 4, 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