AI Agent Human Approval Setup Guide
In this article
Setting up human approval for AI agents before they take action is a critical safety and governance practice. It ensures that an autonomous system cannot execute high-impact or irreversible actions without a person explicitly reviewing and confirming them. This guide covers the core concepts and practical steps to implement a human-in-the-loop (HITL) approval workflow, regardless of whether you are using a no-code platform, a custom API, or an open-source agent framework.
What You'll Need
- An AI agent or automation platform that supports custom actions or API calls (e.g., n8n, Zapier, LangChain, AutoGen, or a custom-built system).
- Access to the agent's configuration or code where actions are defined.
- A way to send notifications and receive approvals (e.g., email, Slack, Microsoft Teams, or a custom web dashboard).
- Basic understanding of your agent's action types and risk levels.
- For custom implementations: a backend server or serverless function to handle approval logic and webhooks.
Step-by-Step
- Identify which actions require approval. List all actions your agent can take. Categorize them by risk: irreversible actions (sending emails, making purchases, deleting data, publishing content) should always require approval; reversible or low-impact actions (reading data, generating drafts) can run automatically.
- Choose an approval mechanism. Decide how the human will approve or reject. Common options: email with Approve/Reject links, a Slack message with buttons, a Teams adaptive card, or a custom web form. The mechanism must be secure (authenticated) and easy to use.
- Design the approval request message. The message must include: the agent's name, the action requested, all relevant parameters (e.g., email recipient, amount, content), the reason for the action, and a unique approval ID. Include a link to a detailed log if needed.
- Implement the approval workflow in your agent.
- No-code platforms: Use a “wait for approval” node or a “human-in-the-loop” step. For example, in n8n, add a “Wait” node that pauses the workflow until a webhook is called. In Zapier, use the “Delay” or “Wait” action combined with a separate approval app.
- Code-based frameworks: Before executing the action, call a function that sends the approval request and then blocks (pauses) the agent's execution. Store the approval request in a database with a status (pending, approved, rejected).
- Set up the approval endpoint. Create an HTTP endpoint (webhook) that receives approval/rejection responses. It should validate the approval ID and update the request status. For security, use a signed token or a one-time secret.
- Connect the approval response to the agent. When the endpoint receives an approval, it should trigger the agent to continue (e.g., by resuming the workflow or calling a webhook that the agent is listening to). When rejected, the agent should log the rejection and stop.
- Add a timeout and fallback. If no response within a set time (e.g., 24 hours), decide what happens: auto-reject, escalate to a second approver, or continue with a default safe action. Always log the outcome.
- Test thoroughly. Run the agent in a sandbox environment. Test approval, rejection, timeout, and invalid approval IDs. Verify that the agent does not proceed without approval and that the approval link works only once.
- Monitor and audit. Log every approval request and response. Review logs regularly to catch errors or misuse. Set up alerts for failed approvals or unusual patterns.
Common Mistakes
- Not distinguishing between reversible and irreversible actions. Requiring approval for every trivial action makes the system annoying and leads to approver fatigue.
- Approval links that are not secure. If the approval link is just a URL with an ID, anyone with the link can approve. Use signed tokens or require authentication.
- No timeout. Without a timeout, the agent may hang indefinitely, blocking other tasks.
- Ignoring the context. The approval request must contain enough context for the human to make an informed decision. A vague request will lead to mistakes or unnecessary rejections.
- Not testing the “reject” path. Many only test the happy path. A broken reject path can cause the agent to execute anyway.
Tips
- Start with a conservative approach: approve more actions initially, then relax as trust grows.
- Use a dedicated approval channel (e.g., a Slack channel) to avoid mixing with other notifications.
- Include a “view details” link so approvers can see the full context before deciding.
- Implement a “dry run” mode where the agent logs what it would do without actually doing it.
- For high-risk actions, require two-person approval (dual control).
- Use a database to store approval requests so you have a complete audit trail.
Troubleshooting
- The agent does not pause for approval. Check that the approval step is placed before the action in the workflow. In code, ensure the function that sends the request is synchronous (awaited) and that the agent's execution is blocked until a response is received.
- Approval link returns an error. Verify the endpoint URL is correct and that the approval ID exists. Check that the token is not expired. Ensure the endpoint is publicly accessible if using a cloud notification service.
- Agent proceeds after rejection. This usually means the rejection response is not being handled correctly. Check that the webhook response contains the correct status and that the agent's code checks for that status before continuing.
- Approval requests are not being sent. Check the notification service credentials (e.g., Slack token, email SMTP). Test the notification separately.
- Timeout is not working. Ensure the timeout is implemented in the agent's code, not just in the notification service. Use a separate timer or a scheduled job to check pending requests.
Frequently Asked Questions
Can I set up human approval without coding?
Yes. Many no-code automation platforms like n8n, Zapier, and Microsoft Power Automate have built-in approval steps or integrate with approval apps. You can create a workflow that pauses and waits for a human response.
How do I make sure the approval is secure?
Use a signed URL with a one-time token, or require the approver to log in. For email, include a unique link with a hash. For Slack/Teams, use the platform's built-in action buttons which are tied to the user's identity.
What if the approver is unavailable?
Set a timeout. After the timeout, you can either auto-reject, escalate to a backup approver, or take a predefined safe action. Make sure the timeout is long enough to be practical but short enough to avoid blocking the agent.
Should I require approval for every action?
No. Only for actions that are irreversible, costly, or sensitive. For routine, low-risk actions, let the agent operate autonomously. This balances safety with efficiency.
Can I have multiple approval levels?
Yes. For high-risk actions, you can implement a multi-step approval where two different people must approve. This is common for financial transactions or major system changes.
How do I audit the approvals?
Log every approval request with a timestamp, the action details, the approver, and the response. Store logs in a central system (e.g., a database or SIEM) and review them periodically.