Agentic AI
Human-in-the-Loop AI Agents: How to Add Approval Steps Before Sensitive Actions
How to make AI agents wait for human approval before sensitive actions: which platforms support it (LangGraph, n8n, CrewAI, OpenAI Agents SDK, ADK) and tested code.
Short answer: A human-in-the-loop (HITL) agent pauses before a risky step, shows a person exactly what it wants to do, and only continues after that person approves, edits or rejects it. Most serious agent platforms now support this: LangGraph (`interrupt()`), LangChain (`HumanInTheLoopMiddleware`), n8n (human review on AI Agent tools, via Slack, Teams, Gmail, WhatsApp and more), CrewAI (`@human_feedback` in Flows), the OpenAI Agents SDK (`needs_approval`), Microsoft Agent Framework (`ApprovalRequiredAIFunction`) and Google ADK (`require_confirmation`). The platform is the easy part. The design work is deciding which actions need approval, showing the reviewer the real parameters, and making sure the write cannot happen without that approval.
What "human in the loop" means for an AI agent
An AI agent is a model that works towards a goal by choosing and calling tools in a loop (see what is agentic AI if that is new). Some of those tools only read data. Others change something in the real world: they send an email, update a customer record in the ERP, issue a refund, merge code or delete a file.
Human in the loop means a person sits inside that loop for selected steps. The agent proposes an action, the run pauses, a reviewer decides, and the run continues with that decision. You will also see human on the loop, which usually means people monitor an agent that acts on its own and step in when something looks wrong. On-the-loop is fine for low-risk work; for actions you cannot undo, you want a person in the loop, before the action runs.
Why bother? Agents make mistakes, and they can be manipulated. OWASP's Top 10 for LLM Applications (2025) lists Excessive Agency as a vulnerability, with "excessive autonomy" as one root cause, and recommends human-in-the-loop control "to require a human to approve high-impact actions before they are taken" (OWASP LLM06:2025). The Model Context Protocol specification makes the same point for tools: "there SHOULD always be a human in the loop with the ability to deny tool invocations" (MCP specification, Tools).
Which actions should need approval?
Not every tool call needs a human. If you ask for approval on everything, reviewers start clicking "approve" without reading, which is worse than no review. Sort the agent's tools into tiers first:
| Tier | Examples | Suggested control |
|---|---|---|
| Read-only | Search a knowledge base, read an order, query a report | No approval; read-only credentials and logging |
| Reversible, internal | Create a draft, add an internal note, open a ticket | Usually no approval; easy undo and an audit log |
| Changes business records | Update a credit limit, change an order status, edit a CRM field | Approval, with the old and new value shown |
| External or irreversible | Send an email or message to a customer, pay or refund, delete data, deploy | Always approval; consider two approvers for large amounts |
| Out of scope | Anything the use case does not need | Do not give the agent this tool at all |
The last row matters most. OWASP's first mitigations are to minimise the tools an agent can call, minimise what each tool can do and minimise its permissions, before you even get to approval steps (OWASP LLM06:2025). An approval step on a tool that should not exist is a weak control.
You can also make approval conditional: a refund under a small threshold runs automatically, a larger one waits for a manager. Most platforms below let you decide per call, in code.
Which AI agent platforms support approval steps?
This table answers the question we see most often: which platforms let an agent wait for a human before it updates a business system. It is summarised from each project's official documentation on 27 November 2026; these tools release often, so check the linked docs for current details.
| Platform | How approval works | Reviewer can | Where the run waits |
|---|---|---|---|
| LangGraph | Call `interrupt()` inside a node or tool; resume with `Command(resume=...)` on the same `thread_id` | Approve, reject, edit state, answer a question (whatever your code accepts) | Checkpointer saves graph state; waits indefinitely until resumed |
| LangChain agents | `HumanInTheLoopMiddleware` with an `interrupt_on` policy per tool | `approve`, `edit`, `reject`, `respond` | LangGraph persistence underneath |
| n8n | "Human review" step on the AI Agent node's tools | Approve or deny | Workflow pauses; request goes to Chat, Slack, Discord, Telegram, Microsoft Teams, Gmail, WhatsApp Business Cloud, Google Chat or Outlook |
| CrewAI | `@human_feedback` decorator in Flows (CrewAI 1.8.0+); webhook-based HITL in the enterprise product | Give feedback that routes to outcomes such as approved or rejected | Flow pauses for feedback; enterprise runs sit in "Pending Human Input" |
| OpenAI Agents SDK | `needs_approval=True` (or a function that decides per call) on a tool | Approve or reject each pending tool call | Run returns `interruptions`; `RunState` can be serialised and resumed later |
| Microsoft Agent Framework | Wrap a function in `ApprovalRequiredAIFunction` | Approve or reject (with an optional reason) | Response contains `ToolApprovalRequestContent`; reply in the same session |
| Google ADK | `FunctionTool(..., require_confirmation=True)` or a structured confirmation request | Yes/no, or return structured data | Run pauses for confirmation (experimental in ADK TypeScript, Go and Kotlin) |
Sources: LangGraph interrupts, LangChain human-in-the-loop, n8n human-in-the-loop for tools, CrewAI human feedback in flows, CrewAI HITL workflows, OpenAI Agents SDK human-in-the-loop, Microsoft Agent Framework tool approval, Google ADK action confirmations.
Two details from those docs are worth knowing before you choose:
- Microsoft is explicit that the marker is not the enforcement. Its API reference says `ApprovalRequiredAIFunction` "does not enforce the requirement for user approval; it is the responsibility of the invoker to obtain that approval before invoking the function" (Microsoft Learn). In every framework, your application code is what actually holds the line.
- The OpenAI Agents SDK fails closed when a per-call approval rule cannot safely read the tool arguments (missing, malformed or non-object JSON): it asks for manual approval instead of guessing (OpenAI Agents SDK). That is the behaviour you want from any custom rule you write, too.
If you are still choosing a framework, our LangGraph vs CrewAI vs AutoGen and n8n vs LangGraph guides compare them on more than approvals.
Worked example: approval before an ERP update in LangGraph
Here is a small, complete LangGraph program. An agent proposes raising a customer's credit limit in an "ERP" (a Python dictionary here, so it runs without any accounts or API keys). The graph pauses before the write, a reviewer rejects one request and edits another, and only the approved change reaches the ERP. In a real agent, an LLM would write the proposal; the approval mechanics are identical.
We tested this on 27 November 2026 with Python 3.13 and `langgraph` 1.2.24 (`pip install langgraph`).
from typing import Literal, Optional, TypedDict
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.graph import END, START, StateGraph
from langgraph.types import Command, interrupt
# A fake "ERP" table. In real life this is your ERP/CRM API or database.
CUSTOMERS = {"C-1001": {"name": "Asha Traders", "credit_limit": 50000}}
AUDIT_LOG = []
class State(TypedDict):
request: str
customer_id: str
proposed_limit: int
decision: Optional[dict]
result: Optional[str]
def propose(state: State):
# An LLM would read the request and draft this change.
return {"customer_id": "C-1001", "proposed_limit": 80000}
def human_review(state: State) -> Command[Literal["apply_change", "cancelled"]]:
current = CUSTOMERS[state["customer_id"]]["credit_limit"]
# Pause here. Nothing has been written yet.
decision = interrupt({
"action": "update_credit_limit",
"customer_id": state["customer_id"],
"current_limit": current,
"proposed_limit": state["proposed_limit"],
"options": ["approve", "edit", "reject"],
})
if decision.get("type") == "approve":
return Command(goto="apply_change", update={"decision": decision})
if decision.get("type") == "edit":
return Command(goto="apply_change",
update={"decision": decision,
"proposed_limit": int(decision["new_limit"])})
return Command(goto="cancelled", update={"decision": decision})
def apply_change(state: State):
# The side effect runs only after approval, in its own node.
# Setting a value (not adding to it) is idempotent, so a retry is safe.
CUSTOMERS[state["customer_id"]]["credit_limit"] = state["proposed_limit"]
AUDIT_LOG.append({"customer": state["customer_id"],
"new_limit": state["proposed_limit"],
"approved_by": state["decision"].get("reviewer")})
return {"result": f"Credit limit set to {state['proposed_limit']}"}
def cancelled(state: State):
reason = state["decision"].get("reason", "no reason given")
return {"result": f"Change rejected: {reason}"}
builder = StateGraph(State)
builder.add_node("propose", propose)
builder.add_node("human_review", human_review)
builder.add_node("apply_change", apply_change)
builder.add_node("cancelled", cancelled)
builder.add_edge(START, "propose")
builder.add_edge("propose", "human_review")
builder.add_edge("apply_change", END)
builder.add_edge("cancelled", END)
graph = builder.compile(checkpointer=InMemorySaver()) # use a database checkpointer in production
def run(thread_id: str, resume_value: dict):
config = {"configurable": {"thread_id": thread_id}}
first = graph.invoke({"request": "Raise Asha Traders' credit limit to 80k"}, config)
print("Paused for review:", first["__interrupt__"][0].value)
print("ERP before decision:", CUSTOMERS["C-1001"]["credit_limit"])
final = graph.invoke(Command(resume=resume_value), config)
print("Result:", final["result"])
print("ERP after decision:", CUSTOMERS["C-1001"]["credit_limit"], "\n")
if __name__ == "__main__":
run("ticket-1", {"type": "reject", "reason": "Needs finance sign-off"})
run("ticket-2", {"type": "edit", "new_limit": 65000, "reviewer": "finance@company"})
print("Audit log:", AUDIT_LOG)Output on our machine:
Paused for review: {'action': 'update_credit_limit', 'customer_id': 'C-1001', 'current_limit': 50000, 'proposed_limit': 80000, 'options': ['approve', 'edit', 'reject']}
ERP before decision: 50000
Result: Change rejected: Needs finance sign-off
ERP after decision: 50000
Paused for review: {'action': 'update_credit_limit', 'customer_id': 'C-1001', 'current_limit': 50000, 'proposed_limit': 80000, 'options': ['approve', 'edit', 'reject']}
ERP before decision: 50000
Result: Credit limit set to 65000
ERP after decision: 65000
Audit log: [{'customer': 'C-1001', 'new_limit': 65000, 'approved_by': 'finance@company'}]What to notice:
- The pause happens before the write. The ERP value is unchanged while the run waits, and a rejected run never reaches `apply_change`.
- The reviewer sees the current and the proposed value, not a vague "the agent wants to update a customer". Show the real parameters.
- The write lives in its own node, after the interrupt. LangGraph's docs explain that when you resume, the node that called `interrupt()` runs again from the beginning, so any code before the `interrupt` runs twice. They recommend placing side effects after the interrupt or in a separate node, and keeping them idempotent (LangGraph interrupts).
- `thread_id` is the bookmark. Resume with the same `thread_id` you started with. `InMemorySaver` keeps checkpoints in RAM and loses them on restart, so production systems use a persistent checkpointer such as PostgreSQL (LangGraph persistence). Approvals can take hours; your state must survive a deploy.
If you are using LangChain's `create_agent`, you do not need to write the review node yourself: `HumanInTheLoopMiddleware` lets you list which tools interrupt and which decisions (`approve`, `edit`, `reject`, `respond`) are allowed for each (LangChain docs).
The same idea in n8n (no code)
n8n is popular for this because the approval request can go wherever your team already works. The setup in n8n's docs is short (n8n human-in-the-loop for tools):
- Build an AI Agent node with its tools, for example an ERPNext node that can retrieve and update documents. n8n's ERPNext node can be used as an AI tool and supports create, retrieve, update and delete operations on documents (n8n ERPNext node).
- Open the AI Agent's Tools panel, add a Human review step and choose the channel (Slack, Teams, Gmail, WhatsApp Business Cloud, Telegram, n8n Chat and others).
- Connect only the risky tools, such as "Update a document", to the human review step. Leave read tools such as "Retrieve a document" connected directly.
- Write the reviewer message with the `$tool.name` and `$tool.parameters` variables so the approver sees exactly which tool and values the agent chose.
- Tell the agent in its system prompt which tools need approval and what to do when a request is denied. n8n's docs flag this as required so the agent handles rejections gracefully.
For approvals that are not tied to a single tool call (for example, "approve this weekly purchase plan"), n8n's Wait node can pause a whole workflow until a webhook call or form submission arrives, with an optional time limit (n8n Wait node).
Agents that query live ERP data: read freely, write with approval
A common real-world request is "an agent that answers questions from our live ERP and can fix records". A safe design splits it in two:
- Read path: tools that run fixed, parameterised queries (for example "get open orders for customer X") with a read-only ERP user. No approval needed, but log every call. Avoid a free-form "run any SQL" tool; OWASP's example of excessive permissions is exactly a read tool whose database identity can also update and delete (OWASP LLM06:2025).
- Write path: a small number of narrow tools ("set credit limit", "change order status") using a separate identity, each behind an approval step that shows the old value, the new value and why.
In n8n, that is the ERPNext (or HTTP Request) node for reads plus a human-reviewed tool for writes. In LangGraph, it is read tools bound to the model and write tools that call `interrupt()` before they act. Either way, the ERP's own permissions should block a write that did not go through approval; never rely on the model to decide what it is allowed to do.
What makes an approval step actually safe
- Enforce it outside the model. The approval check belongs in code or in the target system, not in a prompt that says "always ask first". OWASP calls this complete mediation: authorise in downstream systems "rather than relying on an LLM to decide if an action is allowed".
- Show the reviewer real, specific parameters: who, what, old value, new value, amount, recipient.
- Re-check after a long pause. LangGraph's docs advise re-reading external state (price, inventory, policy) after a long interrupt before the write, because the world may have changed.
- Make writes idempotent (set a value, use an idempotency key) so a retry after approval cannot apply the change twice.
- Record who approved what and when. An audit log is what lets you prove control later and spot rubber-stamping.
- Handle "no answer". Decide what happens if nobody responds: expire the request and tell the user, rather than auto-approving.
- Keep approvals rare enough to be read. Tier your tools; if reviewers approve hundreds of trivial requests a day, they stop reading.
- Keep the review channel trusted. Anyone who can answer the approval message can approve the action, so restrict who receives it.
Common mistakes
- Putting `interrupt()` after the write, or doing the write in the same node before the pause.
- Using an in-memory checkpointer in production and losing every pending approval on restart.
- Giving the agent a powerful general tool (shell, raw SQL, "send any email") and hoping approval catches misuse.
- Approval messages that say "Approve action?" with no details.
- Treating a rejection as an error, so the agent retries the same action instead of explaining or asking what to change.
- Letting the same person request and approve high-value changes.
Learn to build agents with approval steps
Approval-gated agents are a core production skill, and you learn them best by building one end to end. Datamarcos's Applied Agentic AI Certification is a live, mentor-led 8-week program that uses n8n, LangChain, LangGraph, CrewAI and Google ADK, with a project every week; no prior AI experience is required. The 18-week Generative AI & Agentic AI Engineer program covers memory, human-in-the-loop and agent evaluation, and its multi-agent ops copilot project combines a LangGraph supervisor, MCP tools, Jira and ServiceNow integration and human approval. Neither program promises a job; both are built around projects you can show.
For practice ideas, see agentic AI projects for beginners (project 10 is a document-checking workflow with human approval), the agentic AI roadmap, or browse all guides. Teams that want hands-on agent training can ask about corporate training; Datamarcos has trained teams at 200+ organizations.
FAQ
What is human-in-the-loop in agentic AI?
It is a design where an AI agent pauses at selected steps, usually before a sensitive action, and waits for a person to approve, edit or reject what it proposes. The agent continues only with that human decision, so high-impact actions are never taken on the model's judgement alone.
Which AI agent platforms support human approval before sensitive actions?
LangGraph (interrupts), LangChain (HumanInTheLoopMiddleware), n8n (human review on AI Agent tools), CrewAI (the @human_feedback decorator in Flows), the OpenAI Agents SDK (needs_approval), Microsoft Agent Framework (ApprovalRequiredAIFunction) and Google ADK (tool confirmation) all support it. Check each project's docs, as features change often.
How do I add an approval step in LangGraph?
Call interrupt() in a node or tool before the risky action, compile the graph with a checkpointer, run it with a thread_id, show the interrupt payload to a reviewer and resume with Command(resume=decision) on the same thread_id. Put the actual write after the interrupt, ideally in its own node.
Can n8n wait for human approval before an AI agent updates a business system?
Yes. Add a Human review step to the AI Agent's tools panel, pick a channel such as Slack, Teams, Gmail or WhatsApp, and connect only the risky tools to it. The workflow pauses until someone approves or denies the tool call.
What is the difference between human in the loop and human on the loop?
Human in the loop means a person must decide before certain actions run. Human on the loop means the system acts on its own while people monitor it and can intervene. Use in-the-loop for irreversible or external actions, and on-the-loop for low-risk, easily reversed work.
Which agent actions should require human approval?
Anything that sends external messages, moves money, deletes data, deploys code or changes important business records such as credit limits, prices or order status. Read-only lookups and easily reversible internal drafts usually do not need approval, but should still be logged.
Does adding human approval make an AI agent secure?
No, it is one layer. Also limit which tools the agent has, give each tool the minimum permissions, enforce authorisation in the target system, defend against prompt injection and keep an audit log. Approval catches mistakes the other layers miss.
Related program
Applied Agentic AI Certification
8 weeks, live and mentor-led: a project in every module, from LLM foundations and production RAG to multi-agent systems and MCP, ending in an integrated capstone.
Sources
Accessed 27 November 2026.
- LangGraph docs: Interrupts
- LangGraph docs: Persistence
- LangChain docs: Human-in-the-loop middleware
- n8n docs: Human-in-the-loop for tools
- n8n docs: Wait node
- n8n docs: ERPNext node
- CrewAI docs: Human feedback in Flows
- CrewAI docs: Human-in-the-Loop workflows
- OpenAI Agents SDK: Human-in-the-loop
- Microsoft Learn: Using function tools with human in the loop approvals
- Microsoft Learn: ApprovalRequiredAIFunction class
- Google ADK: Action confirmations
- Model Context Protocol specification: Tools
- OWASP Top 10 for LLM Applications 2025: LLM06 Excessive Agency