Kill Switch
Instantly kill and revive individual agents or your entire fleet. Priority 999 overrides all rules. Per-process in OSS.
Instantly halt individual agents or your entire fleet within a single process. Kill switch operates at priority 999 — it overrides every other policy rule, no exceptions. Import from governance-sdk/kill-switch.
Scope: Kill state is in-process. Each replica has its own. For distributed kill propagation across a fleet, use the Lua Governance Cloud control plane.
Functions
| Function | Signature | Description |
|---|---|---|
createKillSwitch | createKillSwitch(gov: Governance) => KillSwitch | Create a kill switch instance bound to a governance instance. |
ks.kill | ks.kill(agentId: string, reason: string, killedBy?: string) => Promise<KillRecord> | Kill a single agent. All subsequent enforce() calls return blocked. |
ks.killAll | ks.killAll(reason: string, killedBy?: string) => Promise<KillRecord[]> | Kill every agent in the fleet. Nuclear option. |
ks.revive | ks.revive(agentId: string, reason?: string) => Promise<void> | Revive a single killed agent. Resumes normal policy evaluation. |
ks.reviveAll | ks.reviveAll(reason?: string) => Promise<void> | Revive all killed agents. Restores normal fleet operation. |
ks.isKilled | ks.isKilled(agentId: string) => boolean | Check whether a specific agent is currently killed. |
ks.isFleetKilled | ks.isFleetKilled() => boolean | Check whether the entire fleet is currently killed. |
Usage
Note: Priority 999 means the kill switch decision is evaluated before all other rules. Even if a rule explicitly allows an action, a killed agent stays blocked.
Enforce Integration
Killed agents are blocked automatically by enforce(). No extra checks needed in your agent code.
API Route Pattern
Expose a kill endpoint so operators can halt agents from a dashboard or monitoring system.