> For the complete documentation index, see llms.txt.
Skip to main content

Check out Port for yourself ➜ 

Contain agents with a kill switch

Every production agent needs to be interruptible: a way for people to intervene and stop it. Not after a redeploy, not after someone finds the right credentials, but immediately, by the people responsible for it.

A kill switch in AgentOps is not a single button. It is a set of escalating responses, from notifying an owner to retiring the agent completely. Each one is a Port workflow, triggered automatically by a detected violation or manually by an authorized person.

Why every agent needs a kill switch​

Today, when an agent misbehaves, stopping it means finding its credentials, its hosting platform and its owner under pressure, while it keeps running. Teams often end up with two options: do nothing or tear everything down.

With a kill switch in Port, containment levels are defined in advance, wired to each agent's identity and platform, and exposed as self-service actions. Some run automatically when a violation is detected, and others wait for a human.

Pain pointWithout PortWith Port
Slow containmentA misbehaving agent keeps spending money, changing systems or exposing data while people look for how to stop it and who is allowed to.Containment actions are wired to each agent, and Port permissions define who can run them, so the right person can stop an agent in seconds.
All or nothingTeams either overreact and stop useful work, or hesitate and let damage continue.Escalating containment levels let you respond in proportion, from a flag to decommissioning.
No recordThe organization can't learn from incidents, so the same failure happens again.Every containment action is recorded on the agent and feeds its review.

Containment levels​

Containment levels escalate from least to most disruptive:

  1. Flag - mark the agent and notify its owner. The agent keeps running.
  2. Restrict - reduce what the agent can do. For example, remove a tool or an allowed workflow, or require approval for every action.
  3. Pause - stop the agent's running sessions and block new ones, for example by blocking its AI gateway key or removing who can trigger it. Its configuration and credentials stay intact, so it can be resumed.
  4. Revoke - rotate or revoke the agent's credentials, so it can no longer act on any system.
  5. Decommission - retire the agent. Remove its credentials and access, and mark it as deprecated in the registry.

Port doesn't stop agents itself. Each containment workflow calls the controls of the platforms the agent depends on. For example, it can stop a running session on Amazon Bedrock AgentCore or interrupt one on Claude managed agents, disable an action group on a Bedrock agent, block a key on your AI gateway, or rotate credentials in your vault. The levels stay the same wherever the agent runs, only the calls behind them change.

Diagram of kill switch containment levels from least to most disruptive. 1, flag: notify the owner; can be automatic. 2, restrict: remove tools or require approval; can be automatic. 3, pause: stop running sessions and block new ones; can be automatic. 4, revoke: rotate or revoke credentials; can be automatic. 5, decommission: retire and mark deprecated; always needs human approval. Automatic responses should be reversible.

Automatic or human-approved​

Decide in advance which triggers lead to which level, and whether a human needs to approve. A simple matrix might look like this:

TriggerResponseApproval
Agent has no ownerFlagAutomatic
Agent loads a skill that lost its certificationRestrict: require approval for every actionAutomatic
Token cost per session spikes above a thresholdRestrict, then pause if it continuesAutomatic, owner notified
Agent calls the AI gateway with a personal key instead of its ownPauseAutomatic, owner notified
A secret scanner finds the agent's credentials exposedRevoke credentialsAutomatic, on-call paged
Agent is unused or replacedDecommissionHuman approval

A good rule of thumb is that automatic responses should be reversible. Anything permanent, such as decommissioning, should wait for a human.

Who can pull it​

Manual containment is exposed as self-service actions on each agent's page in Port, and can also be triggered through Port's MCP server or the Port API. Use workflow permissions to decide who can run each level:

  • The agent's owning team can flag, restrict and pause its own agents.
  • On-call engineers can pause and revoke any production agent during an incident.
  • The platform or security team can run every level, including decommissioning.

Recovery and follow-up​

Containment is the start of a process, not the end:

  • Restore through the gates - a restricted or paused agent returns to full access only after it passes its promotion gate again.
  • Review what happened - record the trigger, the response and the root cause on the agent.
  • Feed it back - use what you learned to adjust thresholds, gate criteria or the agent itself. See self-improvement routines.