@backendkit-labs/auto-learning 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +17 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -10,6 +10,8 @@
10
10
 
11
11
  Static resilience configuration is a guess. `@backendkit-labs/auto-learning` observes your actual traffic, detects anomalies, and adjusts thresholds continuously — so your circuit breaker opens at the right rate, your bulkhead concurrency matches real load, and your HTTP timeouts reflect actual p95 latency rather than a number someone typed four years ago.
12
12
 
13
+ > **Not machine learning.** This library uses descriptive statistics (averages, percentiles, standard deviation) and deterministic rules with exponential smoothing. There are no models, no training data, and no weights. The name reflects the *behavior* — the system learns what "normal" looks like for your traffic — not the technique.
14
+
13
15
  Optional NestJS integration included — global interceptor that records patterns automatically, and adapters that push config changes directly to `CircuitBreakerRegistry` and `BulkheadRegistry`.
14
16
 
15
17
  ---
@@ -176,6 +178,21 @@ That's it. Every request to `GET /orders` is recorded automatically. The feedbac
176
178
 
177
179
  ## Core Concepts
178
180
 
181
+ ### How it actually works (no ML)
182
+
183
+ Despite the name, this library does not use machine learning. The techniques are deliberate:
184
+
185
+ | Technique | Where it's used |
186
+ |-----------|----------------|
187
+ | Descriptive statistics (avg, p50/p95/p99, error rate) | Aggregating patterns per endpoint |
188
+ | Threshold comparison against a rolling baseline | Anomaly detection |
189
+ | Exponential smoothing: `current + (target − current) × factor` | Gradual timeout adjustment |
190
+ | Deterministic step rules (+1/−1, ±10×n) | Retry and circuit breaker tuning |
191
+
192
+ **Why not ML?** Statistical rules are transparent, deterministic, and need no training data. You can read the tuning logic, predict its output, and reason about its behavior in production. A neural network that adjusts your circuit breaker threshold is a black box with no explanation for why it opened your circuit at 3 AM.
193
+
194
+ The trade-off is that the rules are hand-crafted and may not fit every traffic pattern perfectly. The configuration knobs (`smoothingFactor`, `errorRateThreshold`, `latencyStdDevThreshold`) let you adapt the behavior to your system without touching the code.
195
+
179
196
  ### Pattern Recording
180
197
 
181
198
  A **pattern** is a single observation of one HTTP request: method, path, status code, duration, and timestamp. Patterns are the raw data from which everything else is derived.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backendkit-labs/auto-learning",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "license": "Apache-2.0",
5
5
  "author": {
6
6
  "name": "BackendKit Labs",