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

FunctionSignatureDescription
createKillSwitchcreateKillSwitch(gov: Governance) => KillSwitchCreate a kill switch instance bound to a governance instance.
ks.killks.kill(agentId: string, reason: string, killedBy?: string) => Promise<KillRecord>Kill a single agent. All subsequent enforce() calls return blocked.
ks.killAllks.killAll(reason: string, killedBy?: string) => Promise<KillRecord[]>Kill every agent in the fleet. Nuclear option.
ks.reviveks.revive(agentId: string, reason?: string) => Promise<void>Revive a single killed agent. Resumes normal policy evaluation.
ks.reviveAllks.reviveAll(reason?: string) => Promise<void>Revive all killed agents. Restores normal fleet operation.
ks.isKilledks.isKilled(agentId: string) => booleanCheck whether a specific agent is currently killed.
ks.isFleetKilledks.isFleetKilled() => booleanCheck whether the entire fleet is currently killed.

Usage

ts

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.

ts

API Route Pattern

Expose a kill endpoint so operators can halt agents from a dashboard or monitoring system.

ts