Skip to content

n8n Human in the Loop: Add Approval Before an AI Agent Acts

Guides
A cream folder sits against a steel gate between a teal tray and a closed amber tray on a sunlit desk.
AI-generated illustration of a draft held for review.
Add a human in the loop in n8n by pausing before a tool takes action. Show the reviewer what the tool would do, where it would do it and what data it would use. The flow needs a fresh yes for that exact request.
Start with a fake task. The sample flow asks to create draft FAQ-07 from a short return rule. A yes puts one draft in the run output. A no or a late reply leaves it out. You can learn how the gate works before you give an agent access to a real app.

Import the n8n human in the loop sample

The export targets a private, self-hosted n8n 2.48.6 test instance. Keep the lab on your own machine. It needs no model key, inbox or shared database. From the workflow menu, import the JSON from a file. Keep it unpublished and run the sample by hand.
Open Propose sample draft. It shows the action, target, exact draft, request ID and due time. It also shows the URL for the current run. The Wait node will pause until it receives a POST or hits the time limit. The URL belongs to this one run. Keep it private.
On a shared flow, use n8n's Human review option on the AI Agent's Tools connector. Pick a channel and a reviewer who can make the decision. Put the write tool behind that step. A look-up tool can stay separate if it has the right read-only scope.

Check four outcomes in the run log

  1. Approve. Read the full draft. Use the sample command in the setup note to post its ID and approve to its own review URL. Check for approvedDraft in the last node.
  2. Reject. Start a new run and post reject with that run's ID. The result should show no draft.
  3. Time out. Start one more run and let the two minutes pass. A wake-up without a valid yes must leave the draft out.
  4. Retry. Start a new request after you fix the issue. Check that the old ID earns no approval for the new run. Review and approve the new draft on its own.
Seven checks ran the gate code outside n8n with sample run data. The tests include a stale approval, a blank reply and a late reply. The four steps above show how to check import and live waits on an n8n instance. The test results in the archive cover the gate code.

Set the bounds for real work

In a team flow, make sure the reviewer sees the same fields the tool will use. Give the tool a narrow account and have the destination reject repeat writes for the same action ID. Log the reviewer, action ID, time and outcome. Keep raw private inputs out of review channels when the task can use a short preview.
A late reply, missing reviewer or failed send should stop the write. Check the run log before you retry. Use the agent permission guide to pick what needs a yes, and the agent security guide to plan the stops. For a task that ends in a draft a person can review, start with these ChatGPT workflows for work.
loading

Loading