Guard, Detect, Protect.
Pure system-level profiler for AI data privacy. Like cProfile, but for data movement.
No AI, No API, No cloud, No regex, Works offline, Works air-gapped.
Install
pip install antguard
Optional extras:
pip install antguard[gpu] # NVIDIA GPU monitoring
pip install antguard[policy] # YAML policy files
pip install antguard[llmevalkit] # combined report bridge
pip install antguard[all] # everything
Quick Start
from antguard import Guard
# Context manager (recommended)
with Guard(watch=["./data/"]) as g:
# your code runs here - completely unchanged
agent.run("process confidential.pdf")
# The one answer that matters
print(g.did_data_leave()) # True or False
# Save reports
g.save("./logs/") # creates .log + .txt + .json
What It Monitors
| Layer | What | How |
|---|---|---|
| File | Every read, write, copy, move, delete | watchdog + SHA256 fingerprinting |
| Network | Every outbound connection, bytes sent | psutil network polling |
| Process | Process creation, shell commands, suspicious binaries | psutil process tree |
| Correlation | Match file bytes to outbound network data | Chunk hash + size + temporal |
| Runtime | CPU, GPU, memory, disk I/O | psutil + pynvml (optional) |
| Policy | Enforce file/network/process rules | Declarative YAML or dict |
| Observer | Detect calls to known service endpoints | Network destination matching |
| Bridge | Combined antguard + llmevalkit report | Optional unified audit |
How It Works
antguard wraps your code from the outside. It never reads file contents. It tracks data flow by fingerprinting files and correlating byte movement.
API
from antguard import Guard, Policy
guard = Guard(
watch=["./data/"], # directories to monitor
detect_outbound=True, # network monitoring
track_processes=True, # process tree monitoring
correlate=True, # byte-flow correlation
runtime=True, # CPU/GPU/memory metrics
gpu=True, # GPU monitoring
policy=Policy({...}), # security rules (optional)
observe_endpoints=True, # endpoint detection (optional)
log_path="./logs/", # log output directory
)
guard.start()
# ... your code ...
guard.stop()
# Core
guard.did_data_leave() # bool
guard.file_events() # list of file events
guard.net_events() # list of network events
guard.proc_events() # list of process events
guard.correlations() # file-to-network matches
guard.matched_files() # files found in outbound data
guard.runtime_metrics() # CPU, GPU, memory summary
guard.risk_level() # LOW / MEDIUM / HIGH / CRITICAL
guard.anomalies() # runtime anomalies
guard.data_flow_map() # full byte flow visualization
guard.save("./logs/") # write reports
guard.summary() # one-line summary
# Policy
guard.policy_violations() # list of rule violations
guard.generate_baseline() # auto-generate policy from observation
# Observer
guard.endpoint_calls() # detected service endpoint calls
guard.file_to_endpoint() # file read -> endpoint correlations
guard.observer_summary() # services, call counts, bytes
Policy Engine
Define rules for allowed behavior. Three modes: audit, detect, enforce.
from antguard import Guard, Policy
policy = Policy({
"file": {
"allow_read": ["./data/*"],
"deny_read": ["~/.ssh/*", "~/.aws/*"],
},
"network": {
"allow": ["localhost"],
"deny_all_other": True,
},
"process": {
"deny_shell": True,
},
"mode": "detect",
})
with Guard(watch=["./data/"], policy=policy) as g:
your_code()
for v in g.policy_violations():
print(f"{v.category}: {v.rule} ({v.severity.value})")
Load from YAML: policy = Policy.from_yaml("antguard-policy.yaml")
Combined Report (Bridge)
Optional integration with llmevalkit for unified audit.
from antguard import Guard
from antguard.bridge import UnifiedAudit
with Guard(watch=["./data/"]) as g:
response = your_code()
# with llmevalkit evaluation (optional)
audit = UnifiedAudit(guard=g, evaluation={"faithfulness": 0.94, ...})
audit.save("./reports/")
# without llmevalkit (standalone)
audit = UnifiedAudit(guard=g)
audit.save("./reports/")
Report Output
Text report (antguard_report_*.txt):
antguard Profiler Report
==================================================
Session : a1b2c3d4
Platform : Linux (6.5.0)
Duration : 12.3 seconds
DATA LEFT SYSTEM: NO
-- FILE EVENTS (2) --
[MODIFY ] ./data/salary.pdf 240.0 KB python(pid 4521) LOW
[CREATE ] ./output/summary.txt 1.0 KB python(pid 4521) LOW
-- NETWORK EVENTS (0) --
None
-- PROCESS EVENTS (3 total, 0 suspicious) --
All processes normal
-- BYTE-FLOW CORRELATIONS (0) --
No file-to-network correlations detected
-- RUNTIME METRICS (12 samples) --
CPU avg/peak : 35.2% / 72.1%
Memory avg/peak : 8.2 GB / 8.5 GB
Process RSS : 156.0 MB avg, 189.0 MB peak
GPU : not detected
==================================================
OVERALL RISK: LOW
==================================================
Cross-Platform
| Component | Windows | Linux | macOS |
|---|---|---|---|
| File monitoring | ReadDirectoryChangesW | inotify | FSEvents |
| Network monitoring | WMI | /proc/net | lsof |
| Process monitoring | Windows API | /proc | sysctl |
| GPU (NVIDIA) | pynvml | pynvml | N/A |
| CPU/Memory | psutil | psutil | psutil |
Demos
| Demo | What it shows |
|---|---|
| Full Audit | All features combined — the showcase demo |
| Exfiltration Detection | Catches data sent to external server |
| File Monitoring | File tracking + SHA256 fingerprinting |
| Suspicious Process | Shell and subprocess detection |
| Runtime Metrics | CPU, GPU, memory profiling |
| Wrap Any Library | Zero code changes — cProfile pattern |
| Policy Engine | Define rules, detect violations, baselines |
| Endpoint Observer | Detects calls to known service endpoints |
| Combined Report | System behavior + quality in one report |
No models, no API keys, no downloads needed. Every demo runs with plain Python.
Google Colab: Open quickstart notebook
Dependencies
Core: watchdog + psutil (that's it)
Optional: pynvml (GPU), pyyaml (YAML policies), llmevalkit (combined report)
Memory Footprint
< 25 MB RAM regardless of session length. Events stream to disk.
Part of the Ant Intelligence Ecosystem
- antguard - Guard. Detect. Protect. (system profiler)
- llmevalkit - Evaluate. Score. Improve. (AI evaluation)
- Together: full AI system audit
License
Apache 2.0
Author
Venkatkumar Rajan
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file antguard-0.2.0.tar.gz.
File metadata
- Download URL: antguard-0.2.0.tar.gz
- Upload date:
- Size: 3.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fe24f28e1b52407a55eb474902d71797daeaa116fe8ab083ef09ea60ec1b03e
|
|
| MD5 |
c9498c68614bb62c390822581d349844
|
|
| BLAKE2b-256 |
0d4ba49f705a8c219f6c839017e7de449bd7a4c346f815a764b06ab418921c62
|
File details
Details for the file antguard-0.2.0-py3-none-any.whl.
File metadata
- Download URL: antguard-0.2.0-py3-none-any.whl
- Upload date:
- Size: 35.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcd60390529fd5fac85807b58b50d9f25d5b7d1813293320f1915380f14f3c1e
|
|
| MD5 |
1389da61fd49bbac75cd520532c41301
|
|
| BLAKE2b-256 |
2ca680b2676ee531adcefa18ab97815270cd766d5bbc95352337980bef248535
|