Phase 2: Control & Containment · ~60 minutes · Python (stdlib · three-detector simulator: kill switch · circuit breaker
Kill Switches, Circuit Breakers, and Canary Tokens
A kill switch is a boolean held outside the agent's edit surface — a Redis key, a feature flag, a signed config — that disables the agent entirely.
Introduction
A circuit breaker is finer-grained: it trips on a specific pattern (five identical tool calls in a row), pauses the offending path, and escalates to a human. A canary token inherits from classical deception: a fake credential or honeypot record an agent has no legitimate reason to touch, whose access triggers an alert. eBPF-based datapaths (e.g. Cilium) can rewrite a quarantined pod's egress to a forensic honeypot at the kernel layer; published Cilium benchmarks report sub-millisecond P99 datapath latency under load (your propagation budget depends on how a policy update reaches the node, not the datapath itself). Statistical detectors (EWMA, CUSUM) that adapt to a moving baseline will quietly accept drift — layer them with hard constitutional limits that do not bend.
- Type: Learn
- Languages: Python (stdlib, three-detector simulator: kill switch, circuit breaker, canary)
- Prerequisites: Action Budgets, Iteration Caps, and Cost Governors, Permission Modes for Autonomous Agents
- Time: ~60 minutes
The Problem
Cost governors (Action Budgets, Iteration Caps, and Cost Governors) bound what the agent can spend. They do not bound what the agent can do inside the budget. An agent with a $50 velocity limit can still exfiltrate a secret, publish the wrong post, or delete a resource — the expensive action is often the cheap one in tokens.
This lesson covers the three detectors that sit next to the cost layer:
- Kill switch: boolean off-button held outside the agent's reach.
- Circuit breaker: action-pattern detector that pauses a specific path.
- Canary token: bait that an agent with no legitimate reason to touch will reveal itself by touching.
All three are pre-LLM engineering. Classical deception, rate-limit breakers, and feature-flag kills predate autonomous agents. What's new is the attack surface: agents read untrusted content (Browser Agents and Long-Horizon Web Tasks), edit their own memory, and can compose many safe-looking actions into an unsafe one. The detectors named here work because they do not trust the agent's self-report.
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers The Concept, Build, Check Yourself, Key Terms & Next — plus a hands-on lab, quiz, and project artifact.
Create a free account — the opening phases of 29 of 35 courses, and the first lesson of every phase, are free, no credit card.
Browse all courses · View pricing · DeVenture Academy