SentryML
The security layer every LLM-powered app is missing.
Real-time prompt injection firewall — scan user input before it reaches your LLM.
Install
pip install sentryml
Quickstart (3 lines)
import sentryml
sentryml.configure(api_key="your-key", api_url="https://sentryml-api-jihxilyyya-nw.a.run.app")
safe_prompt = sentryml.guard(user_message) # raises ThreatBlockedError if attack detected
Get an API key
Sign up free at https://nastwest-u26wck-618.web.app
10,000 scans/month. No credit card.
How it works
User Input → sentryml.guard() → SentryML API → BLOCK/ALLOW → Your LLM
Detects 8 attack types using semantic similarity (all-MiniLM-L6-v2) with token-level explainability.
Attack types detected
- prompt_injection, jailbreak, role_hijacking, data_exfiltration
- indirect_injection, goal_hijacking, context_manipulation
Full scan response
result = sentryml.scan('your prompt', app_id='my-chatbot')
print(result.severity) # critical / high / medium / low / safe
print(result.threat_score) # 0.0 – 1.0
print(result.attack_type) # prompt_injection / jailbreak / etc
print(result.recommended_action) # block / flag / allow
print(result.latency_ms) # scan latency
print(result.carbon_g_co2e) # CO2e grams per scan
print(result.token_explanations) # SHAP token attribution
print(result.threat_summary) # Gemini-generated narrative
Guard pattern (recommended)
from sentryml.exceptions import ThreatBlockedError
def chat(user_message: str) -> str:
try:
safe_prompt = sentryml.guard(user_message)
except ThreatBlockedError as e:
return f'Blocked: {e.result.attack_type} ({e.result.threat_score:.0%})'
return llm.complete(safe_prompt)
Async support
result = await sentryml.scan_async(user_message, app_id='my-app')
Carbon tracking
Every scan returns carbon_g_co2e. Blocked attacks save CO2 by preventing unnecessary LLM calls.
Track your AI security carbon footprint in the live dashboard.
Live dashboard
Release files for sentryml 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sentryml-0.1.2.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sentryml-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / sentryml-0.1.2.tar.gz
| Download URL | sentryml-0.1.2.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f69530d08eca2438ff5a6c191d74a3646ad0460d44a570c87878644c28600bd7
|
|
BLAKE2b-256 checksum How to use checksums |
ead3cdb86113102ed2eecfef56fec646706e2eb14473734cc4dd4b3b08b1b1bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / sentryml-0.1.2-py3-none-any.whl
| Download URL | sentryml-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dca835ea27f2e31d4bdb48217fbaae51e290659bc293f7329c5bec394f228667
|
|
BLAKE2b-256 checksum How to use checksums |
77a2c012774420bd55174c873de05960d9bb6931cc3cc02405d0849f2b583a94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|