WaveGuardClient 2.0.0__tar.gz

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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Greg Partin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,306 @@
1
+ Metadata-Version: 2.4
2
+ Name: WaveGuardClient
3
+ Version: 2.0.0
4
+ Summary: Python SDK for WaveGuard — physics-based anomaly detection API
5
+ Author: Greg Partin
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/gpartin/WaveGuardClient
8
+ Project-URL: Documentation, https://github.com/gpartin/WaveGuardClient/tree/main/docs
9
+ Project-URL: Repository, https://github.com/gpartin/WaveGuardClient
10
+ Project-URL: Issues, https://github.com/gpartin/WaveGuardClient/issues
11
+ Project-URL: API, https://gpartin--waveguard-api-fastapi-app.modal.run/docs
12
+ Keywords: anomaly-detection,api-client,sdk,waveguard,physics-based,mcp,model-context-protocol,azure-migration
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: System Administrators
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Classifier: Topic :: System :: Monitoring
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: requests>=2.28
28
+ Provides-Extra: mcp
29
+ Requires-Dist: requests>=2.28; extra == "mcp"
30
+ Requires-Dist: fastapi>=0.100; extra == "mcp"
31
+ Requires-Dist: uvicorn>=0.20; extra == "mcp"
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=7.0; extra == "dev"
34
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ <p align="center">
38
+ <img src="https://img.shields.io/pypi/v/WaveGuardClient?style=for-the-badge&color=blueviolet" alt="PyPI">
39
+ <img src="https://img.shields.io/badge/API-v2.0.0_stateless-brightgreen?style=for-the-badge" alt="v2.0.0">
40
+ <img src="https://img.shields.io/badge/GPU-CUDA_accelerated-76B900?style=for-the-badge&logo=nvidia" alt="CUDA">
41
+ <img src="https://img.shields.io/badge/MCP-Claude_Desktop-orange?style=for-the-badge" alt="MCP">
42
+ </p>
43
+
44
+ <h1 align="center">WaveGuard Python SDK</h1>
45
+
46
+ <p align="center">
47
+ <strong>Anomaly detection powered by wave physics. Not machine learning.</strong><br>
48
+ One API call. Fully stateless. Works on any data type.
49
+ </p>
50
+
51
+ <p align="center">
52
+ <a href="#quickstart">Quickstart</a> •
53
+ <a href="#use-cases">Use Cases</a> •
54
+ <a href="#examples">Examples</a> •
55
+ <a href="docs/api-reference.md">API Reference</a> •
56
+ <a href="docs/mcp-integration.md">MCP / Claude</a> •
57
+ <a href="docs/azure-migration.md">Azure Migration</a>
58
+ </p>
59
+
60
+ ---
61
+
62
+ ## What is WaveGuard?
63
+
64
+ WaveGuard is a **general-purpose anomaly detection API**. Send it any data — server metrics, financial transactions, log files, sensor readings, time series — and get back anomaly scores, confidence levels, and explanations of *which features* triggered the alert.
65
+
66
+ **No training pipelines. No model management. No state. One API call.**
67
+
68
+ ```
69
+ Your data → WaveGuard API (GPU) → Anomaly scores + explanations
70
+ ```
71
+
72
+ Under the hood, it uses GPU-accelerated wave physics instead of machine learning. You don't need to know or care about the physics — it's all server-side.
73
+
74
+ <details>
75
+ <summary><strong>How does it actually work?</strong></summary>
76
+
77
+ Your data is encoded onto a 32³ lattice and run through coupled wave equation simulations on GPU. Normal data produces stable wave patterns; anomalies produce divergent ones. A 52-dimensional statistical fingerprint is compared between training and test data. Everything is torn down after each call — nothing is stored.
78
+
79
+ The key advantage over ML: no training data requirements (2+ samples is enough), no model drift, no retraining, no hyperparameter tuning. Same API call works on structured data, text, numbers, and time series.
80
+
81
+ </details>
82
+
83
+ ## Install
84
+
85
+ ```bash
86
+ pip install WaveGuardClient
87
+ ```
88
+
89
+ That's it. The only dependency is `requests`. All physics runs server-side on GPU.
90
+
91
+ ## Quickstart
92
+
93
+ The same `scan()` call works on any data type. Here are three different industries — same API:
94
+
95
+ ### Detect a compromised server
96
+
97
+ ```python
98
+ from waveguard import WaveGuard
99
+
100
+ wg = WaveGuard(api_key="YOUR_KEY")
101
+
102
+ result = wg.scan(
103
+ training=[
104
+ {"cpu": 45, "memory": 62, "disk_io": 120, "errors": 0},
105
+ {"cpu": 48, "memory": 63, "disk_io": 115, "errors": 0},
106
+ {"cpu": 42, "memory": 61, "disk_io": 125, "errors": 1},
107
+ ],
108
+ test=[
109
+ {"cpu": 46, "memory": 62, "disk_io": 119, "errors": 0}, # ✅ normal
110
+ {"cpu": 99, "memory": 95, "disk_io": 800, "errors": 150}, # 🚨 anomaly
111
+ ],
112
+ )
113
+
114
+ for r in result.results:
115
+ print(f"{'🚨' if r.is_anomaly else '✅'} score={r.score:.1f} confidence={r.confidence:.0%}")
116
+ ```
117
+
118
+ ### Flag a fraudulent transaction
119
+
120
+ ```python
121
+ result = wg.scan(
122
+ training=[
123
+ {"amount": 74.50, "items": 3, "session_sec": 340, "returning": 1},
124
+ {"amount": 52.00, "items": 2, "session_sec": 280, "returning": 1},
125
+ {"amount": 89.99, "items": 4, "session_sec": 410, "returning": 0},
126
+ ],
127
+ test=[
128
+ {"amount": 68.00, "items": 2, "session_sec": 300, "returning": 1}, # ✅ normal
129
+ {"amount": 4200.00, "items": 25, "session_sec": 8, "returning": 0}, # 🚨 fraud
130
+ ],
131
+ )
132
+ ```
133
+
134
+ ### Catch a security event in logs
135
+
136
+ ```python
137
+ result = wg.scan(
138
+ training=[
139
+ "2026-02-24 10:15:03 INFO Request processed in 45ms [200 OK]",
140
+ "2026-02-24 10:15:04 INFO Request processed in 52ms [200 OK]",
141
+ "2026-02-24 10:15:05 INFO Cache hit ratio=0.94 ttl=300s",
142
+ ],
143
+ test=[
144
+ "2026-02-24 10:20:03 INFO Request processed in 48ms [200 OK]", # ✅ normal
145
+ "2026-02-24 10:20:04 CRIT xmrig consuming 98% CPU, port 45678 open", # 🚨 crypto miner
146
+ "2026-02-24 10:20:05 WARN GET /api/users?id=1;DROP TABLE users-- from 185.x.x", # 🚨 SQL injection
147
+ ],
148
+ encoder_type="text",
149
+ )
150
+ ```
151
+
152
+ **Same client. Same `scan()` call. Any data.**
153
+
154
+ ## Use Cases
155
+
156
+ WaveGuard works on **any structured, numeric, or text data**. If you can describe "normal," it can detect deviations.
157
+
158
+ | Industry | What You Scan | What It Catches |
159
+ |----------|---------------|------------------|
160
+ | **DevOps** | Server metrics (CPU, memory, latency) | Memory leaks, DDoS attacks, runaway processes |
161
+ | **Fintech** | Transactions (amount, velocity, location) | Fraud, money laundering, account takeover |
162
+ | **Security** | Log files, access events | SQL injection, crypto miners, privilege escalation |
163
+ | **IoT / Manufacturing** | Sensor readings (temp, pressure, vibration) | Equipment failure, calibration drift |
164
+ | **E-commerce** | User behavior (session time, cart, clicks) | Bot traffic, bulk purchase fraud, scraping |
165
+ | **Healthcare** | Lab results, vitals, biomarkers | Abnormal readings, data entry errors |
166
+ | **Time Series** | Metric windows (latency, throughput) | Spikes, flatlines, seasonal breaks |
167
+
168
+ **The API doesn't know your domain.** It just knows what "normal" looks like (your training data) and flags anything that deviates. This makes it general — you bring the context, it brings the detection.
169
+
170
+ ### Supported Data Types
171
+
172
+ All auto-detected from data shape. No configuration needed:
173
+
174
+ | Type | Example | Use When |
175
+ |------|---------|----------|
176
+ | JSON objects | `{"cpu": 45, "memory": 62}` | Structured records with named fields |
177
+ | Numeric arrays | `[1.0, 1.2, 5.8, 1.1]` | Feature vectors, embeddings |
178
+ | Text strings | `"ERROR segfault at 0x0"` | Logs, messages, free text |
179
+ | Time series | `[100, 102, 98, 105, 99]` | Metric windows, sequential readings |
180
+
181
+ ## Examples
182
+
183
+ Every example is a runnable Python script. They span **6 industries and 4 data types** to show WaveGuard isn't tied to one domain:
184
+
185
+ | # | Example | Industry | Data Type | What It Shows |
186
+ |---|---------|----------|-----------|---------------|
187
+ | 01 | [Quickstart](examples/01_quickstart.py) | General | JSON | Minimal scan in 10 lines |
188
+ | 02 | [Server Monitoring](examples/02_server_monitoring.py) | DevOps | JSON | Memory leak + DDoS detection |
189
+ | 03 | [Log Analysis](examples/03_log_analysis.py) | Security | Text | SQL injection, crypto miner, stack traces |
190
+ | 04 | [Time Series](examples/04_time_series.py) | Monitoring | Numeric | Latency spikes, flatline detection |
191
+ | 05 | [Azure Migration](examples/05_azure_migration.py) | Enterprise | JSON | Side-by-side Azure replacement |
192
+ | 06 | [Batch Scanning](examples/06_batch_scanning.py) | E-commerce | JSON | 20 transactions, fraud flagging |
193
+ | 07 | [Error Handling](examples/07_error_handling.py) | Production | — | Retry logic, exponential backoff |
194
+
195
+ ## MCP Server (Claude Desktop)
196
+
197
+ Give Claude the ability to detect anomalies. Add to your Claude Desktop config:
198
+
199
+ ```json
200
+ {
201
+ "mcpServers": {
202
+ "waveguard": {
203
+ "command": "python",
204
+ "args": ["/path/to/WaveGuardClient/mcp_server/server.py"],
205
+ "env": {
206
+ "WAVEGUARD_API_KEY": "your-key"
207
+ }
208
+ }
209
+ }
210
+ }
211
+ ```
212
+
213
+ Then ask Claude: *"Check if these server metrics are anomalous..."*
214
+
215
+ See [MCP Integration Guide](docs/mcp-integration.md) for full setup.
216
+
217
+ ## Azure Migration
218
+
219
+ **Azure Anomaly Detector retires October 2026.** WaveGuard is a drop-in replacement:
220
+
221
+ ```python
222
+ # Before (Azure) — 3+ API calls, stateful, time-series only
223
+ client = AnomalyDetectorClient(endpoint, credential)
224
+ model = client.train_multivariate_model(request) # minutes
225
+ result = client.detect_multivariate_batch_anomaly(model_id, data)
226
+ client.delete_multivariate_model(model_id)
227
+
228
+ # After (WaveGuard) — 1 API call, stateless, any data type
229
+ wg = WaveGuard(api_key="YOUR_KEY")
230
+ result = wg.scan(training=normal_data, test=new_data) # seconds
231
+ ```
232
+
233
+ See [Azure Migration Guide](docs/azure-migration.md) for details.
234
+
235
+ ## API Reference
236
+
237
+ ### `wg.scan(training, test, encoder_type=None, sensitivity=None)`
238
+
239
+ | Parameter | Type | Description |
240
+ |-----------|------|-------------|
241
+ | `training` | `list` | 2+ examples of normal data |
242
+ | `test` | `list` | 1+ samples to check |
243
+ | `encoder_type` | `str` | Force: `"json"`, `"numeric"`, `"text"`, `"timeseries"` (default: auto) |
244
+ | `sensitivity` | `float` | 0.5–3.0, lower = more sensitive (default: 1.0) |
245
+
246
+ Returns `ScanResult` with `.results` (per-sample) and `.summary` (aggregate).
247
+
248
+ ### `wg.health()` / `wg.tier()`
249
+
250
+ Health check (no auth) and subscription tier info.
251
+
252
+ ### Error Handling
253
+
254
+ ```python
255
+ from waveguard import WaveGuard, AuthenticationError, RateLimitError
256
+
257
+ try:
258
+ result = wg.scan(training=data, test=new_data)
259
+ except AuthenticationError:
260
+ print("Bad API key")
261
+ except RateLimitError:
262
+ print("Too many requests — back off and retry")
263
+ ```
264
+
265
+ Full API reference: [docs/api-reference.md](docs/api-reference.md)
266
+
267
+ ## Project Structure
268
+
269
+ ```
270
+ WaveGuardClient/
271
+ ├── waveguard/ # Python SDK package
272
+ │ ├── __init__.py # Public API exports
273
+ │ ├── client.py # WaveGuard client class
274
+ │ └── exceptions.py # Exception hierarchy
275
+ ├── mcp_server/ # MCP server for Claude Desktop
276
+ │ ├── server.py # stdio + HTTP transport
277
+ │ └── README.md # MCP setup guide
278
+ ├── examples/ # 7 runnable examples
279
+ ├── docs/ # Documentation
280
+ │ ├── getting-started.md
281
+ │ ├── api-reference.md
282
+ │ ├── mcp-integration.md
283
+ │ └── azure-migration.md
284
+ ├── tests/ # Test suite (runs offline)
285
+ ├── pyproject.toml # Package config (pip install -e .)
286
+ └── CHANGELOG.md
287
+ ```
288
+
289
+ ## Development
290
+
291
+ ```bash
292
+ git clone https://github.com/gpartin/WaveGuardClient.git
293
+ cd WaveGuardClient
294
+ pip install -e ".[dev]"
295
+ pytest
296
+ ```
297
+
298
+ ## Links
299
+
300
+ - **Live API**: https://gpartin--waveguard-api-fastapi-app.modal.run
301
+ - **Interactive Docs (Swagger)**: https://gpartin--waveguard-api-fastapi-app.modal.run/docs
302
+ - **PyPI**: https://pypi.org/project/WaveGuardClient/
303
+
304
+ ## License
305
+
306
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,270 @@
1
+ <p align="center">
2
+ <img src="https://img.shields.io/pypi/v/WaveGuardClient?style=for-the-badge&color=blueviolet" alt="PyPI">
3
+ <img src="https://img.shields.io/badge/API-v2.0.0_stateless-brightgreen?style=for-the-badge" alt="v2.0.0">
4
+ <img src="https://img.shields.io/badge/GPU-CUDA_accelerated-76B900?style=for-the-badge&logo=nvidia" alt="CUDA">
5
+ <img src="https://img.shields.io/badge/MCP-Claude_Desktop-orange?style=for-the-badge" alt="MCP">
6
+ </p>
7
+
8
+ <h1 align="center">WaveGuard Python SDK</h1>
9
+
10
+ <p align="center">
11
+ <strong>Anomaly detection powered by wave physics. Not machine learning.</strong><br>
12
+ One API call. Fully stateless. Works on any data type.
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="#quickstart">Quickstart</a> •
17
+ <a href="#use-cases">Use Cases</a> •
18
+ <a href="#examples">Examples</a> •
19
+ <a href="docs/api-reference.md">API Reference</a> •
20
+ <a href="docs/mcp-integration.md">MCP / Claude</a> •
21
+ <a href="docs/azure-migration.md">Azure Migration</a>
22
+ </p>
23
+
24
+ ---
25
+
26
+ ## What is WaveGuard?
27
+
28
+ WaveGuard is a **general-purpose anomaly detection API**. Send it any data — server metrics, financial transactions, log files, sensor readings, time series — and get back anomaly scores, confidence levels, and explanations of *which features* triggered the alert.
29
+
30
+ **No training pipelines. No model management. No state. One API call.**
31
+
32
+ ```
33
+ Your data → WaveGuard API (GPU) → Anomaly scores + explanations
34
+ ```
35
+
36
+ Under the hood, it uses GPU-accelerated wave physics instead of machine learning. You don't need to know or care about the physics — it's all server-side.
37
+
38
+ <details>
39
+ <summary><strong>How does it actually work?</strong></summary>
40
+
41
+ Your data is encoded onto a 32³ lattice and run through coupled wave equation simulations on GPU. Normal data produces stable wave patterns; anomalies produce divergent ones. A 52-dimensional statistical fingerprint is compared between training and test data. Everything is torn down after each call — nothing is stored.
42
+
43
+ The key advantage over ML: no training data requirements (2+ samples is enough), no model drift, no retraining, no hyperparameter tuning. Same API call works on structured data, text, numbers, and time series.
44
+
45
+ </details>
46
+
47
+ ## Install
48
+
49
+ ```bash
50
+ pip install WaveGuardClient
51
+ ```
52
+
53
+ That's it. The only dependency is `requests`. All physics runs server-side on GPU.
54
+
55
+ ## Quickstart
56
+
57
+ The same `scan()` call works on any data type. Here are three different industries — same API:
58
+
59
+ ### Detect a compromised server
60
+
61
+ ```python
62
+ from waveguard import WaveGuard
63
+
64
+ wg = WaveGuard(api_key="YOUR_KEY")
65
+
66
+ result = wg.scan(
67
+ training=[
68
+ {"cpu": 45, "memory": 62, "disk_io": 120, "errors": 0},
69
+ {"cpu": 48, "memory": 63, "disk_io": 115, "errors": 0},
70
+ {"cpu": 42, "memory": 61, "disk_io": 125, "errors": 1},
71
+ ],
72
+ test=[
73
+ {"cpu": 46, "memory": 62, "disk_io": 119, "errors": 0}, # ✅ normal
74
+ {"cpu": 99, "memory": 95, "disk_io": 800, "errors": 150}, # 🚨 anomaly
75
+ ],
76
+ )
77
+
78
+ for r in result.results:
79
+ print(f"{'🚨' if r.is_anomaly else '✅'} score={r.score:.1f} confidence={r.confidence:.0%}")
80
+ ```
81
+
82
+ ### Flag a fraudulent transaction
83
+
84
+ ```python
85
+ result = wg.scan(
86
+ training=[
87
+ {"amount": 74.50, "items": 3, "session_sec": 340, "returning": 1},
88
+ {"amount": 52.00, "items": 2, "session_sec": 280, "returning": 1},
89
+ {"amount": 89.99, "items": 4, "session_sec": 410, "returning": 0},
90
+ ],
91
+ test=[
92
+ {"amount": 68.00, "items": 2, "session_sec": 300, "returning": 1}, # ✅ normal
93
+ {"amount": 4200.00, "items": 25, "session_sec": 8, "returning": 0}, # 🚨 fraud
94
+ ],
95
+ )
96
+ ```
97
+
98
+ ### Catch a security event in logs
99
+
100
+ ```python
101
+ result = wg.scan(
102
+ training=[
103
+ "2026-02-24 10:15:03 INFO Request processed in 45ms [200 OK]",
104
+ "2026-02-24 10:15:04 INFO Request processed in 52ms [200 OK]",
105
+ "2026-02-24 10:15:05 INFO Cache hit ratio=0.94 ttl=300s",
106
+ ],
107
+ test=[
108
+ "2026-02-24 10:20:03 INFO Request processed in 48ms [200 OK]", # ✅ normal
109
+ "2026-02-24 10:20:04 CRIT xmrig consuming 98% CPU, port 45678 open", # 🚨 crypto miner
110
+ "2026-02-24 10:20:05 WARN GET /api/users?id=1;DROP TABLE users-- from 185.x.x", # 🚨 SQL injection
111
+ ],
112
+ encoder_type="text",
113
+ )
114
+ ```
115
+
116
+ **Same client. Same `scan()` call. Any data.**
117
+
118
+ ## Use Cases
119
+
120
+ WaveGuard works on **any structured, numeric, or text data**. If you can describe "normal," it can detect deviations.
121
+
122
+ | Industry | What You Scan | What It Catches |
123
+ |----------|---------------|------------------|
124
+ | **DevOps** | Server metrics (CPU, memory, latency) | Memory leaks, DDoS attacks, runaway processes |
125
+ | **Fintech** | Transactions (amount, velocity, location) | Fraud, money laundering, account takeover |
126
+ | **Security** | Log files, access events | SQL injection, crypto miners, privilege escalation |
127
+ | **IoT / Manufacturing** | Sensor readings (temp, pressure, vibration) | Equipment failure, calibration drift |
128
+ | **E-commerce** | User behavior (session time, cart, clicks) | Bot traffic, bulk purchase fraud, scraping |
129
+ | **Healthcare** | Lab results, vitals, biomarkers | Abnormal readings, data entry errors |
130
+ | **Time Series** | Metric windows (latency, throughput) | Spikes, flatlines, seasonal breaks |
131
+
132
+ **The API doesn't know your domain.** It just knows what "normal" looks like (your training data) and flags anything that deviates. This makes it general — you bring the context, it brings the detection.
133
+
134
+ ### Supported Data Types
135
+
136
+ All auto-detected from data shape. No configuration needed:
137
+
138
+ | Type | Example | Use When |
139
+ |------|---------|----------|
140
+ | JSON objects | `{"cpu": 45, "memory": 62}` | Structured records with named fields |
141
+ | Numeric arrays | `[1.0, 1.2, 5.8, 1.1]` | Feature vectors, embeddings |
142
+ | Text strings | `"ERROR segfault at 0x0"` | Logs, messages, free text |
143
+ | Time series | `[100, 102, 98, 105, 99]` | Metric windows, sequential readings |
144
+
145
+ ## Examples
146
+
147
+ Every example is a runnable Python script. They span **6 industries and 4 data types** to show WaveGuard isn't tied to one domain:
148
+
149
+ | # | Example | Industry | Data Type | What It Shows |
150
+ |---|---------|----------|-----------|---------------|
151
+ | 01 | [Quickstart](examples/01_quickstart.py) | General | JSON | Minimal scan in 10 lines |
152
+ | 02 | [Server Monitoring](examples/02_server_monitoring.py) | DevOps | JSON | Memory leak + DDoS detection |
153
+ | 03 | [Log Analysis](examples/03_log_analysis.py) | Security | Text | SQL injection, crypto miner, stack traces |
154
+ | 04 | [Time Series](examples/04_time_series.py) | Monitoring | Numeric | Latency spikes, flatline detection |
155
+ | 05 | [Azure Migration](examples/05_azure_migration.py) | Enterprise | JSON | Side-by-side Azure replacement |
156
+ | 06 | [Batch Scanning](examples/06_batch_scanning.py) | E-commerce | JSON | 20 transactions, fraud flagging |
157
+ | 07 | [Error Handling](examples/07_error_handling.py) | Production | — | Retry logic, exponential backoff |
158
+
159
+ ## MCP Server (Claude Desktop)
160
+
161
+ Give Claude the ability to detect anomalies. Add to your Claude Desktop config:
162
+
163
+ ```json
164
+ {
165
+ "mcpServers": {
166
+ "waveguard": {
167
+ "command": "python",
168
+ "args": ["/path/to/WaveGuardClient/mcp_server/server.py"],
169
+ "env": {
170
+ "WAVEGUARD_API_KEY": "your-key"
171
+ }
172
+ }
173
+ }
174
+ }
175
+ ```
176
+
177
+ Then ask Claude: *"Check if these server metrics are anomalous..."*
178
+
179
+ See [MCP Integration Guide](docs/mcp-integration.md) for full setup.
180
+
181
+ ## Azure Migration
182
+
183
+ **Azure Anomaly Detector retires October 2026.** WaveGuard is a drop-in replacement:
184
+
185
+ ```python
186
+ # Before (Azure) — 3+ API calls, stateful, time-series only
187
+ client = AnomalyDetectorClient(endpoint, credential)
188
+ model = client.train_multivariate_model(request) # minutes
189
+ result = client.detect_multivariate_batch_anomaly(model_id, data)
190
+ client.delete_multivariate_model(model_id)
191
+
192
+ # After (WaveGuard) — 1 API call, stateless, any data type
193
+ wg = WaveGuard(api_key="YOUR_KEY")
194
+ result = wg.scan(training=normal_data, test=new_data) # seconds
195
+ ```
196
+
197
+ See [Azure Migration Guide](docs/azure-migration.md) for details.
198
+
199
+ ## API Reference
200
+
201
+ ### `wg.scan(training, test, encoder_type=None, sensitivity=None)`
202
+
203
+ | Parameter | Type | Description |
204
+ |-----------|------|-------------|
205
+ | `training` | `list` | 2+ examples of normal data |
206
+ | `test` | `list` | 1+ samples to check |
207
+ | `encoder_type` | `str` | Force: `"json"`, `"numeric"`, `"text"`, `"timeseries"` (default: auto) |
208
+ | `sensitivity` | `float` | 0.5–3.0, lower = more sensitive (default: 1.0) |
209
+
210
+ Returns `ScanResult` with `.results` (per-sample) and `.summary` (aggregate).
211
+
212
+ ### `wg.health()` / `wg.tier()`
213
+
214
+ Health check (no auth) and subscription tier info.
215
+
216
+ ### Error Handling
217
+
218
+ ```python
219
+ from waveguard import WaveGuard, AuthenticationError, RateLimitError
220
+
221
+ try:
222
+ result = wg.scan(training=data, test=new_data)
223
+ except AuthenticationError:
224
+ print("Bad API key")
225
+ except RateLimitError:
226
+ print("Too many requests — back off and retry")
227
+ ```
228
+
229
+ Full API reference: [docs/api-reference.md](docs/api-reference.md)
230
+
231
+ ## Project Structure
232
+
233
+ ```
234
+ WaveGuardClient/
235
+ ├── waveguard/ # Python SDK package
236
+ │ ├── __init__.py # Public API exports
237
+ │ ├── client.py # WaveGuard client class
238
+ │ └── exceptions.py # Exception hierarchy
239
+ ├── mcp_server/ # MCP server for Claude Desktop
240
+ │ ├── server.py # stdio + HTTP transport
241
+ │ └── README.md # MCP setup guide
242
+ ├── examples/ # 7 runnable examples
243
+ ├── docs/ # Documentation
244
+ │ ├── getting-started.md
245
+ │ ├── api-reference.md
246
+ │ ├── mcp-integration.md
247
+ │ └── azure-migration.md
248
+ ├── tests/ # Test suite (runs offline)
249
+ ├── pyproject.toml # Package config (pip install -e .)
250
+ └── CHANGELOG.md
251
+ ```
252
+
253
+ ## Development
254
+
255
+ ```bash
256
+ git clone https://github.com/gpartin/WaveGuardClient.git
257
+ cd WaveGuardClient
258
+ pip install -e ".[dev]"
259
+ pytest
260
+ ```
261
+
262
+ ## Links
263
+
264
+ - **Live API**: https://gpartin--waveguard-api-fastapi-app.modal.run
265
+ - **Interactive Docs (Swagger)**: https://gpartin--waveguard-api-fastapi-app.modal.run/docs
266
+ - **PyPI**: https://pypi.org/project/WaveGuardClient/
267
+
268
+ ## License
269
+
270
+ MIT — see [LICENSE](LICENSE).