Quick Start
Get your AI kill switch running in under 5 minutes. This guide covers installation, basic configuration, and your first metric report.
1. Install the SDK
JavaScript/TypeScript
bash
npm install @haiec/kill-switchPython
bash
pip install haiec-kill-switch2. Initialize and Report Metrics
typescript
import { KillSwitch } from '@haiec/kill-switch';
// Initialize with your API key
const ks = new KillSwitch({
apiKey: process.env.HAIEC_API_KEY,
systemId: 'hiring-ai-prod',
mode: 'semi-auto' // 'manual' | 'semi-auto' | 'full-auto'
});
// Report metrics from your AI system
await ks.reportMetrics({
accuracy: 0.85,
biasScore: 0.12,
latencyP95: 1.5,
errorRate: 0.02
});
// SDK automatically triggers kill switch if thresholds exceeded
// Or manually trigger:
await ks.trigger({
layer: 2,
reason: 'Manual intervention - suspicious pattern detected'
});3. Configure Callbacks (Optional)
Handle kill switch events in your application to activate fallbacks, notify teams, etc.
typescript
const ks = new KillSwitch({
apiKey: process.env.HAIEC_API_KEY,
systemId: 'hiring-ai-prod',
// Called when kill switch triggers
onTrigger: (event) => {
console.log('Kill switch activated!', event);
// Notify your team, switch to fallback, etc.
notifySlack(`AI system killed: ${event.reason}`);
activateFallbackSystem();
},
// Called when system recovers
onRecover: (event) => {
console.log('System recovered', event);
deactivateFallbackSystem();
},
// Called on SDK errors
onError: (error) => {
console.error('Kill switch error:', error);
}
});