Skip to main content

ProactiveGuard

Predictive failure detection for distributed consensus systems.

ProactiveGuard uses machine learning to predict node failures in etcd, Raft, and CockroachDB clusters — giving you a warning window of up to 30 seconds before a crash or partition occurs.

Install

pip install proactiveguard

Requires Python 3.9+ and no heavy ML dependencies — just requests and numpy.

Authentication

Get your API key from app.proactiveguard.io and set it as an environment variable:

export PROACTIVEGUARD_API_KEY="pg-..."

Or pass it directly when creating the client:

from proactiveguard import ProactiveGuard

pg = ProactiveGuard(api_key="pg-...")

Streaming Monitoring (Real-Time)

Feed one timestep of metrics per node at each collection interval. Once enough observations accumulate, the API returns a prediction automatically.

from proactiveguard import ProactiveGuard

pg = ProactiveGuard()  # reads PROACTIVEGUARD_API_KEY from environment

# Call this every collection interval (e.g. every second)
result = pg.observe("etcd-0", {
    "heartbeat_latency_ms": 22.5,
    "messages_sent": 12,
    "messages_received": 11,
    "messages_dropped": 0,
    "missed_heartbeats": 0,
    "response_rate": 1.0,
    "term": 4,
    "commit_index": 1042,
    "is_leader": False,
})

# result is None while the observation window is filling up
if result and result.is_pre_failure:
    print(f"[ALERT] {result.node_id}: {result.status}")
    print(f"        Risk score : {result.risk_score:.2f}")
    print(f"        Time left  : {result.time_to_failure:.0f}s")
    print(f"        Failure type: {result.failure_type}")

# Or poll the latest prediction at any time
result = pg.status("etcd-0")
if result and result.is_failed:
    print(f"Node {result.node_id} has already failed: {result.status}")

PredictionResult fields

Field Type Description
node_id str Node identifier
status str One of healthy, degraded_30s, degraded_20s, degraded_10s, degraded_5s, failed_crash, failed_slow, failed_byzantine, failed_partition
risk_score float 0.0 = healthy, 1.0 = certain failure
confidence float Model confidence in this prediction (0–1)
time_to_failure float | None Estimated seconds until failure, None if healthy
failure_type str | None crash, slow, byzantine, or partition
is_healthy bool True when status == "healthy"
is_pre_failure bool True when the node is degraded but not yet failed
is_failed bool True when the node has already failed
probabilities dict Full probability distribution over all nine classes

Batch Prediction

If you have pre-collected observation windows (e.g. for offline analysis or model evaluation), you can run batch predictions directly:

import numpy as np
from proactiveguard import ProactiveGuard

pg = ProactiveGuard()

# X shape: (n_samples, window_size=50, n_features=32)
X = np.random.rand(10, 50, 32).astype("float32")

labels = pg.predict(X)          # → array of strings, shape (10,)
probs  = pg.predict_proba(X)    # → float32 array, shape (10, 9)

# With time-to-failure and confidence
labels, ttf, conf = pg.predict_with_ttf(X)
for i in range(len(labels)):
    print(f"Sample {i}: {labels[i]}  ttf={ttf[i]:.0f}s  conf={conf[i]:.2f}")

Resetting State

pg.reset("etcd-0")   # reset one node
pg.reset()           # reset all nodes

Error Handling

from proactiveguard import ProactiveGuard
from proactiveguard.exceptions import AuthenticationError, APIError, RateLimitError

try:
    pg = ProactiveGuard()
    result = pg.observe("etcd-0", metrics)
except AuthenticationError:
    print("Bad API key — check PROACTIVEGUARD_API_KEY")
except RateLimitError:
    print("Rate limit hit — slow down or upgrade plan")
except APIError as e:
    print(f"API error {e.status_code}: {e}")

Self-Hosted / Custom Endpoint

Point the client at your own deployment:

pg = ProactiveGuard(
    api_key="pg-...",
    base_url="https://pg.internal.mycompany.com/v1",
    timeout=10,
)

Copyright (c) 2025 Maya Plus. All rights reserved.

Metadata

Release files for proactiveguard 0.2.1

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

Source distribution (sdist)

Source distribution for proactiveguard 0.2.1
File Size Uploaded Provenance Actions
proactiveguard-0.2.1.tar.gz 9.2 kB With provenance Details for proactiveguard-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 17.5 kB

Release files / proactiveguard-0.2.1.tar.gz

Download URL proactiveguard-0.2.1.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
883c0cbbbbd3ea803abbf125eddf8b31d025bace8abcaf304fc69b94ee463513
BLAKE2b-256 checksum
How to use checksums
a789fc0bf5a257caf155202569d6e8756730a5e7b248fcb228701525d26f617a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 2, 2026.

Transparency log

Release files / proactiveguard-0.2.1-py3-none-any.whl

Download URL proactiveguard-0.2.1-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ce6a32a85125e1cc11bb183cfc57c813d6c6e34f587d23a0cb9fa3d13c203f3
BLAKE2b-256 checksum
How to use checksums
38c84b9b842b70a90231e8abbf0b77d61886574f94e40b315d838aafa264f593
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 2, 2026.

Transparency log

Security for proactiveguard 0.2.1

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for proactiveguard-0.2.1.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 Mar 2, 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.2.1 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