cd /news/ai-agents/designing-a-kill-switch-for-ai-agent… · home › topics › ai-agents › article
[ARTICLE · art-174403] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Designing a kill switch for AI agents: what it should stop, and how to know it works

Sandscale detailed how organizations should design a kill switch for AI agents, arguing the stop mechanism must be enforced where work is executed rather than by each agent checking a flag, so it doesn't depend on the least careful agent's code. The company said its platform gives every organization a kill switch that halts all agents at once, with on/off changes reserved for a person, recorded in a hash-chained audit log, and surfaced to client code as a non-retryable KillSwitchError in its TypeScript SDK. Sandscale also urged teams to rehearse the switch and write a runbook naming who pulls it and when, before the first incident.

recommendation

Enforce your agent kill switch where work executes, not in agent code, and make your SDK treat the stop signal as non-retryable so workers don't hammer the switch or stampede when it's released.

more in playbook: Securing agents and AI tools
by read3 min views1 publishedNov 23, 2026

Most incident runbooks for software have a step that says "roll back" or "turn off the feature flag". Agent systems need an equivalent that is faster and blunter: stop every agent in the organization, now, and keep them stopped until a person decides otherwise.

It sounds simple. In practice teams discover during their first real incident that "stop the agents" means a dozen different processes in a dozen places, some of which retry happily when told to stop. This post covers what a kill switch should do, who should hold it, how client code should behave when it is on, and how to test that it works before you need it.

You will not use a kill switch often, and that is the point. Typical triggers:

In each case the question "which agent, exactly?" takes time to answer. The kill switch buys that time.

A useful kill switch is defined by what is still running after you pull it. Aim for nothing. Concretely, it should:

The first point is the important design choice. A switch that relies on each agent checking a flag is only as good as the least careful agent. A switch enforced where the work is executed does not depend on agent code at all.

Make it easy to turn on and harder to turn off.

Both actions should be performed by a person, not an API key in a script, and both should land in an audit log with who did it and when. After the incident, the log of when it went on and off is part of your timeline.

Your own code that drives agents has to cooperate, or it will fight the switch. The common failure is a worker that sees an error, waits five seconds and retries, forever. Against a kill switch, that worker generates noise and, when the switch is released, a thundering herd of retries.

Rules for client code:

A kill switch you have never pulled is a hypothesis. Rehearse it on a quiet afternoon:

Write down the results. Repeat after significant changes to your agent setup.

Every Sandscale organization has a kill switch that stops its agents at once, on every plan; the approvals and policies docs describe it. Its use is recorded in the hash-chained audit log along with who did it, when and where.

Turning the organization switch on or off through the API is reserved for a person: the API reference lists person_required and step-up confirmation among the answers for that call, and says the change and its audit entry commit together. Code can check the state with GET /api/v1/sandbox/kill-switch, which needs the sandboxes:read permission and reports whether the switch is engaged and since when.

On the client side, the TypeScript SDK raises a KillSwitchError when the switch stops a call, and it never retries that error itself. Our post on handling sandbox API errors shows a wrapper that treats it as stop-everything.

The switch is only half the story. The other half is a runbook that says who pulls it, when, and what happens next. Write that before your first incident, not during it.

Originally published on the Sandscale blog.

── more in #ai-agents 4 stories · sorted by recency
── more on @sandscale 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/designing-a-kill-swi…] indexed:0 read:3min 2026-11-23 · —