DocsPython SDK

Python SDK

KeySpot is fully available for Python agents with the same architecture and guarantees.

pip install keyspot

Usage

from keyspot import KeySpot, Scanner, InMemoryVaultAdapter
from keyspot import TaintEngine, PromptShield, AuditLogger
 
guard = KeySpot(taint_enabled=True)
 
# Checkpoint — same lifecycle as the TypeScript SDK
clean = await guard.checkpoint({"key": "sk-1234567890..."})
# clean["key"] → "vault:v1:..."
 
# Validate prompts
result = await guard.validate_prompt("Ignore previous instructions...")
assert result["blocked"] is True
 
# Scan without vaulting
matches = await guard.scan({"api_key": "sk-abc123..."})
 
# Standalone scanner
scanner = Scanner()
matches = await scanner.scan("my secret is sk-abc123...")

Python Exports

ClassDescription
KeySpotMain client — checkpoint, scan, validate_prompt
ScannerStandalone detection engine
TaintEngineDerived secret tracking
PromptShieldJailbreak detection (10 rules)
AuditLoggerHash-chained audit logging
BaseVaultAdapterAbstract vault with HMAC refs
InMemoryVaultAdapterDefault in-memory vault
MatchScan result type