How do you stop an AI agent?

n8n and LangGraph can pause an agent until a person approves or denies a tool call. LangChain, CrewAI and OpenAI's SDK each cap how many steps an agent takes, with defaults of 15, 20 and a configurable turn limit. A switch that halts a running agent from outside was described only in vendor blogs. Read 2026-11-06.

By Mackenzie Bowes · mackenzie@mackenziebowes.com · @_mackenziebowes on X

Contents

Short answer, from the sources below: the two workflow tools whose pages were read, n8n and LangGraph, both let an agent stop before it uses a tool and wait for a person to approve or deny. Three agent libraries (LangChain, CrewAI and the OpenAI Agents SDK) each stop a looping agent after a set number of steps. Those are the controls the documentation actually describes. A "kill switch" that halts a running agent from outside appears in the search results only on security-vendor pages, and none of the results measures one.

Asking a person before a tool runs in n8n

n8n's documentation says: "You can require human approval before an AI Agent executes a specific tool."[1] When a tool needs review, "the workflow pauses and waits for a person" to approve, which runs the tool "with the input specified by the AI", or to deny, which cancels it.[1] The page names the tools worth gating: "sending messages, modifying records, or deleting data."[1]

The approval can arrive in a different place from the chat. The page lists Chat, Slack, Discord, Telegram, Microsoft Teams, Gmail, WhatsApp Business Cloud, Google Chat and Outlook as channels, and says you could have users talk to the agent in n8n's chat while sending approval requests to one person in Slack.[1] The reviewer sees "which tool the AI wants to use and with what parameters", and you can write the message with the $tool.name and $tool.parameters variables.[1]

One instruction in the page is easy to miss. If a person denies a call, "the AI is informed of the rejection", and the page says to put the review setup in the agent's system prompt so the model "understands which tools require approval and how to respond gracefully when a tool call is denied."[1] The page does not say what happens if you leave that out.

Asking a person before a step runs in LangGraph

LangGraph, the graph library behind many LangChain agents, does the same job in code. You call interrupt() in a node, and the docs say "graph execution gets suspended at the exact point where interrupt is called" and "waits indefinitely until you resume execution with a response."[2] To resume, you send a Command(resume=...) with the same thread ID, and that value becomes what interrupt() returns inside the node.[2] Three things are needed: a checkpointer to save the state ("use a durable checkpointer in production"), a thread ID, and a JSON-serializable payload.[2]

The docs list the patterns as approval before "API calls, database changes, financial transactions", review and edit of a tool call, and checking human input.[2] Two warnings in its rules matter to anyone who builds this. The node restarts from its beginning on resume, "so any code before the interrupt runs again", and so side effects placed before an interrupt "must be idempotent". The page's bad example is a record created before the interrupt, which "will create duplicate records on each resume."[2] The second warning is not to wrap an interrupt call in a bare try/except, which would catch the pause.[2]

n8n's page and LangGraph's page agree on the shape: the agent proposes, a person decides, the run continues. Neither page reports how often reviewers reject a call, or how long a pause lasts in practice. CrewAI's three ways to do the same thing are on CrewAI: human input, tutorial, licence, price.

Stopping a loop with three libraries and three limits

An agent that cannot finish may keep trying. Each library read for this page has a cap.

A step cap stops the run; it does not undo anything the run already did. A limit of 15 steps can still send 15 emails. That is the reason to put the approval step on the tools that cannot be undone.

What turns up on kill switches

A Brave search for "ai agent kill switch" returned a security vendor's guide on soft switches and spend governors, an industry-group containment guide, a podcast, a product launch post and short videos. None was opened for claims, and discussion threads were skipped. So these pages show that kill switches are being sold and written about, but nothing here says what a working one costs, how fast it acts, or whether any team has tested one on a real incident.

What the documentation does give you is closer to a brake than a switch: a limit set before the run (steps, turns, time), and a pause at the tool call. How those controls fit alongside filters and permissions is on AI agent security and guardrails, and what to record so you can see a runaway after it happens is on AI agent monitoring and audit trails. Why agents loop and misread things in the first place is on AI agent failure modes.

Not yet proven

If you have stopped a real agent in production and can say what worked, I would like to hear it: mackenzie@mackenziebowes.com.

Sources

  1. n8n Docs, Human-in-the-loop for tools. Page said "Last updated 8 days ago". Read in Rotunda 2026-11-06. docs.n8n.io/build/integrate-ai/ai-examples/human-in-the-loop-for-tools
  2. LangChain Docs, LangGraph Interrupts. Read in Rotunda 2026-11-06. docs.langchain.com/oss/python/langgraph/interrupts
  3. LangChain Docs, GRAPH_RECURSION_LIMIT. Read in Rotunda 2026-11-06. docs.langchain.com/oss/python/langgraph/errors/GRAPH_RECURSION_LIMIT
  4. LangChain Reference, langchain_classic AgentExecutor max_iterations. Read in Rotunda 2026-11-06. reference.langchain.com/python/langchain-classic/agents/agent/AgentExecutor/max_iterations
  5. LangChain Reference, langchain_classic AgentExecutor early_stopping_method. Read in Rotunda 2026-11-06. reference.langchain.com/python/langchain-classic/agents/agent/AgentExecutor/early_stopping_method
  6. OpenAI Agents SDK, Running agents. Read in Rotunda 2026-11-06. openai.github.io/openai-agents-python/running_agents/
  7. crewAIInc/crewAI repository, docs v1.10.1, concepts/agents.mdx. Read in Rotunda 2026-11-06. github.com/crewAIInc/crewAI/blob/main/docs/v1.10.1/en/concepts/agents.mdx
  8. langchain-ai/langchain issue 6025, Agent Executor stops due to iteration limit or time limit (langchain 0.0.163). Read in Rotunda 2026-11-06. github.com/langchain-ai/langchain/issues/6025

Terms on this page

  • AI agent: A system where a language model decides for itself how to do a task and which tools to use.
  • Human in the loop: A person takes part in an automated system's work, supervision or decisions.
  • LangChain: A software toolkit from LangChain for building AI agents and applications on language models.
  • Tool call: A request from an AI model to run one action, such as a search or a file write, which the surrounding program carries out.