Skip to main content

Tests whether an AI agent or stateful system recovers or cascades after a perturbation, using twin-trajectory divergence analysis. Works with minimal historical data and no model of the system's internals.

Project description

Bendex Resilience

Tests whether an AI agent (or any stateful system) recovers or cascades after a perturbation, like a corrupted memory entry, a failed tool call, or a config change, using twin-trajectory divergence analysis.

What makes this different

Most AI agent testing tools inject a failure and check one thing: did the task still complete? That's a pass/fail light switch. It can't tell the difference between "acting weird but fine" and "acting weird and actually breaking."

This tool instead:

  1. Clones your system into two copies.
  2. Applies a small, controlled perturbation to one copy.
  3. Runs both copies through the same real workload.
  4. Watches whether their behavior stays in sync (recovers) or drifts apart (cascades).

No historical baseline required before you can test it. No model of your system's internals needed. It works by comparing the two live copies to each other, not by comparing to weeks of past data.

Validated results

Tested against a real language model (Qwen2.5-0.5B-Instruct), not just synthetic data. See colab_shareable_demo.py, runnable yourself in one click:

Metric Result
Accuracy (40 trials: 20 healthy, 20 real injected failures) 95.0% (38/40)
Healthy systems correctly left alone 18/20 (2/20 false alarms)
Real failures caught 20/20

Also validated on systems where classical stability-analysis methods don't apply at all: nonlinear systems (90% accuracy against an exact known answer) and systems with memory/delay (100% accuracy against an exact known answer). Also validated to work with far less historical data than standard covariance-based drift detection methods require.

Known limitations, stated plainly, not hidden

  • Detection quality depends on calibration data size. Measured: 62% accuracy at 7 calibration observations, 83% at 25, 95% at 40+. Use at least ~40 observations where possible.
  • Does not yet automatically find your system's worst-case vulnerability. You tell it what scenario to test; it doesn't discover unknown weaknesses on its own. This is open, unsolved work.
  • Does not localize which specific subsystem is failing. Tells you that something broke, not which part of a multi-component system.

Quick start

from resilience_v2 import ResilienceDetector

detector = ResilienceDetector()
detector.calibrate(nominal_trajectory)   # your system's normal behavior
result = detector.check(test_trajectory) # behavior after a perturbation
print(result)  # {'verdict': 'RECOVERS' or 'CASCADES', 'flagged_at_step': ..., ...}

Or run it as an API. See api.py (FastAPI, single /analyze endpoint, stateless).

Files

  • resilience_v2.py: core detector
  • api.py: REST API wrapper
  • colab_shareable_demo.py: real-LLM validation demo, runnable in Colab
  • tests/: stress tests (scale, edge cases, false-positive rate)

License

AGPL-3.0. Commercial licensing available for organizations that cannot use AGPL, see COMMERCIAL-LICENSE.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bendex_resilience-0.1.2.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bendex_resilience-0.1.2-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file bendex_resilience-0.1.2.tar.gz.

File metadata

  • Download URL: bendex_resilience-0.1.2.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for bendex_resilience-0.1.2.tar.gz
Algorithm Hash digest
SHA256 dbf98e5b575ba44ae775a8cd43ac9da38d0fe665462b649b2f8402ac383a78a7
MD5 fc5ab61f4608fc357c175343741c9378
BLAKE2b-256 bd7fbc844bd462925901b235731126f951ed79db8d13183f13ac09c44259d8c4

See more details on using hashes here.

File details

Details for the file bendex_resilience-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for bendex_resilience-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 697212c233fdfea07c6af2716dfdb273328d3b3ad7f76f872d26b9e34afd5ec5
MD5 d2183353203ef85eafe3f0c871133333
BLAKE2b-256 b9b173774bbfed5f389e2a697c9b6dbfaf530315ce622fe7f0bf0d2517b20780

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page