You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains a reference implementation of the **Adaptive Multi‑Dimensional Monitoring (AMDM)** algorithm described in our paper *Adaptive Monitoring and Real‑World Evaluation of Agentic AI Systems* (Advanced version). AMDM is designed to detect anomalies across multiple axes (e.g., capability, robustness, safety, human factors, economics) in streaming logs generated by agentic AI systems.
4
+
5
+
## Features
6
+
7
+
***Rolling normalisation**: Maintains rolling means and standard deviations for each metric to compute per‑metric z‑scores.
8
+
***EWMA thresholds**: Computes exponentially weighted moving averages (EWMAs) per axis and flags per‑axis anomalies when deviations exceed a configurable threshold.
9
+
***Joint anomaly detection**: Maintains a joint mean and covariance matrix of the axis scores and computes a Mahalanobis distance; flags joint anomalies when the distance exceeds a chi‑square threshold.
10
+
***Calibration tools**: Includes a simple method to calibrate parameters (window length, EWMA smoothing and joint threshold) based on a quiet period of normal operation.
11
+
***Synthetic data generator**: Provides a `simulate.py` script to produce synthetic event streams with injected anomalies for demonstration purposes.
12
+
13
+
## Repository structure
14
+
15
+
```
16
+
amdm_repo/
17
+
├── amdm.py # Core implementation of the AMDM algorithm
18
+
├── simulate.py # Generates synthetic data and runs AMDM for a demo
19
+
├── example_data.csv # Sample metrics used in the demo
20
+
├── README.md # Project description and usage instructions
21
+
├── LICENSE # MIT license
22
+
└── .gitignore # Files to ignore in git
23
+
```
24
+
25
+
## Installation
26
+
27
+
This project requires Python 3.8 or later and the following packages:
28
+
29
+
```
30
+
numpy
31
+
scipy
32
+
matplotlib (optional, for plotting in the demo)
33
+
```
34
+
35
+
You can install the dependencies using `pip`:
36
+
37
+
```bash
38
+
pip install numpy scipy matplotlib
39
+
```
40
+
41
+
## Usage
42
+
43
+
### Running the demo
44
+
45
+
The `simulate.py` script generates a synthetic event stream with four metrics spanning two axes (capability and safety) and injects goal‑drift and safety‑violation anomalies. It then runs AMDM on the stream and prints detected anomalies.
46
+
47
+
```bash
48
+
python simulate.py
49
+
```
50
+
51
+
You should see output indicating when per‑axis and joint anomalies are detected. The script also produces a simple plot (requires `matplotlib`) showing the axis scores over time.
52
+
53
+
### Integrating into your system
54
+
55
+
1. Place your streaming logs into a pandas DataFrame where each row corresponds to a time step and each column corresponds to a metric.
56
+
2. Define a dictionary mapping each metric to one of the five axes (capability, robustness, safety, human, economic).
57
+
3. Instantiate the `AMDM` class with the list of metric names, the axis mapping, and desired parameters (`window_size`, `lambda_`, `alpha`, `k`).
58
+
4. Call `update(metrics_dict)` on each time step. The method returns flags indicating per‑axis anomalies and joint anomalies.
59
+
60
+
## License
61
+
62
+
This repository is licensed under the MIT License. See `LICENSE` for details.
63
+
64
+
## Citation
65
+
66
+
If you use this code in your research, please cite our paper:
67
+
68
+
```
69
+
M. A. Shukla. “Adaptive Monitoring and Real‑World Evaluation of Agentic AI Systems,” 2025.
0 commit comments