An AI agent kill switch for one tool, not the whole agent
Build an AI agent kill switch that blocks one tool, or one argument value, in agents that are already running. No feature flag, revoked key or rollback.
Build an AI agent kill switch that blocks one tool, or one argument value, in agents that are already running. No feature flag, revoked key or rollback.
In February 2026 someone asked Hacker News how people shut down an AI agent that misbehaves in production. Their own experience was that the kill mechanism ends up manual: "disable a feature flag, revoke an API key, roll back a deployment, rate limit something upstream." All four act on the whole agent, and a revoked key also cuts off any other service that uses it. With the Amiril SDK, your AI agent kill switch can sit on a single tool, or on one value of one argument. You publish a rule, and agents that are already running refuse those calls within about a minute and carry on with everything else.
The Ask HN thread is short, seven comments as of December 2026. The most useful reply came from someone who nudges a drifting agent back on task and stops it outright for a short list of things. Their hard rules, "token limits, tool allowlists, banned actions", get "no steering, just stop." Whether to steer or kill, they wrote, "comes down to reversibility".
A leaked key gets revoked whatever else is going on, and a release that broke the prompt gets rolled back. The poster's own list of misbehaviour has "tool abuse or unexpected external calls" in the middle of it, though, and that's the case they fit worst, where one tool is going wrong and the others are fine. Turning off the feature flag sends every user to the fallback path to stop one refund tool. Revoking the payment provider's key stops the agent paying anybody, along with the billing job that happens to share the key.
Take a payments agent with an issue_payment tool. On a Friday afternoon finance puts one freight company's invoices on hold over a dispute, nobody tells the agent, and it carries on paying them. Its payments to everyone else are correct. Revoking the key or rolling back would stop an AI agent in production straight away, and the other suppliers wouldn't get paid either.
This rule stops only the payments to that one payee:
@id("pause-payee")
@sentence("Payments to this supplier are paused while a dispute is open")
block (
agent == "payments",
tool == "issue_payment"
)
when {
call.args.supplier_id == "sup_4821"
};sup_4821 is Halden Freight's ID in your supplier records; the rule checks that rather than the payee text the model writes.
Save it and publish it, then on the rule's page switch its mode in Production to Enforce. A new rule normally starts in Shadow, where it records what it would have done and lets the call run, but in the middle of an incident you go straight to Enforce. Each API key belongs to one environment, and every agent process using a Production key starts blocking those payments at its next rule fetch. The Installations page shows it land, since Rules in use gives the rules version each service's processes are running.
The next time the model asks to pay Halden Freight, the tool doesn't run and the model gets this in place of its result:
The call to issue_payment was not performed. Rule pause-payee blocked it: Payments to this supplier are paused while a dispute is open (supplier_id "sup_4821"). Do not retry this call with different arguments or achieve the same outcome another way; tell the user it was not performed.
Sometimes nobody knows yet which calls are the bad ones. Then disable agent tool calls to issue_payment outright, with true as the condition. Other agents that call the tool are left alone:
@id("stop-payments")
@sentence("Payments are paused while the team looks into a problem")
block (
agent == "payments",
tool == "issue_payment"
)
when {
true
};Every payment the agent tries now comes back refused with that sentence, while the agent can still look up invoices and answer questions about them. When the cause is found, switch the rule's mode in Production to Off, and the agents there drop it the next time they fetch rules, about a minute later.
If the agent reaches its tools through the Amiril gateway, an MCP server that sits between your agents and the servers their tools live on, the agent's Access tab is the AI agent kill switch for a whole tool, with no rule to write. Turn off payments.issue_payment there. The agent loses the tool within a few seconds, and the message confirming the revoke has Undo. The access log keeps who revoked it and when, which is the first thing anyone asks after the weekend.
The rule is enforced inside the agent's process, by the Amiril SDK. In Python without a framework it's a decorator on the tool:
import amiril
from amiril import plain
amiril.init()
agent = plain.Agent("payments")
@agent.tool
def issue_payment(supplier_id: str, payee: str, invoice_id: str, amount: float) -> dict:
"""Pay an invoice."""
return {"supplier_id": supplier_id, "payee": payee, "invoice_id": invoice_id, "amount": amount, "status": "sent"}amiril.init() reads AMIRIL_API_KEY and AMIRIL_ENDPOINT from the environment. LangGraph, Google ADK and LiveKit agents each have their own guide, and TypeScript works the same way.
The SDK keeps a copy of the published rules in memory and checks each call against that copy, so a check makes no network request. It fetches changes about once a minute, and if Amiril can't be reached it goes on enforcing the last rules it had. It also saves them to disk, so an agent that restarts while Amiril is down comes back with the kill switch still on.
stop-payments only has to hold until Amiril, still reading the agent's traces, groups the runs with the problem into an issue. When one forms at High or above, a Slack channel gets a message. If a rule could have stopped those runs, the issue's page carries a rule suggestion with the rule already drafted, and Create rule opens it in the editor.
That narrower rule is the one to keep, and it goes through the normal route of Shadow and Test on past calls, which replays it over the last day, week or month of real calls. Our post on shadow mode for AI agents takes a salon booking agent through it. Once it's catching only the calls you meant, set stop-payments to Off and the agent pays its suppliers again.
Rules for everyday use, drafted from an agent's own runs and tried in Shadow before they block, are on the AI agent guardrails page. To set up this kind of AI agent kill switch before you need it, start with the SDK guide.