How to Require Approval for AI Agent Actions: Implementing Production-Ready Gates
A concrete walkthrough of gating agentic tool calls behind a human decision: the request shape, the polling and webhook paths, signature verification, and the edge cases that bite in production.
On this note · 11 sections
- The short answer: gate the tool call, not the model output
- What the approval request actually contains
- Gating agentic tool calls: where to put the check in your loop
- Polling versus webhooks: picking the wait path
- Approval gate implementation: the state machine and its edge cases
- What the audit record must contain to survive an auditor
- Failure modes that show up only in production
- Choosing where to run the gate
- A minimal end-to-end sequence
- Frequently asked questions
- The gate is a status code, not a policy document
To require approval for AI agent actions, intercept execution inside the tool call before any side effect occurs. The runtime dispatches an approval request to a durable state store and halts until an authenticated human resolves it. Prompt instructions fail. A real gate lives at the protocol boundary where the agent writes, sends, or commits.
Placing safety constraints into prompts produces agents that bypass their own rules. A prompt instructing an agent to ask permission before spending money or altering records will fail under context overflows, hallucinations, or prompt injections. Gating belongs at tool boundaries. If an agent attempts to dispatch an email, move money, alter infrastructure, or write a calendar event, the loop must yield control to an external verification service.
The short answer: gate the tool call, not the model output
To require approval for AI agent actions, the agent runtime calls POST /v1/approvals with a one-line summary and a structured JSON evidence payload. The agent runtime then blocks on GET /v1/approvals/{approval_id} or parks its state machine until the approval status transitions to approved or denied.
AgentDraft lets an agent pause any consequential action for human sign-off: it opens an approval request carrying a one-line summary and a JSON evidence payload, a person approves or denies it in the dashboard with an optional note, and the agent reads the outcome back. The gated action does not have to be one AgentDraft performs: a deploy, a migration, or a refund is gated the same way. Every transition lands in the append-only audit trail and fires an approval.* webhook.
This design enforces a strict guarantee. The agent reads the verified outcome back before executing any external side effect. This mechanism eliminates two common production failures:
- An autonomous agent sends unvetted emails, modifies infrastructure, or books unapproved meetings without human oversight.
- An auditor reviews past operations and discovers no deterministic record connecting human intent to the automated side effect.
What the approval request actually contains
An approval gate fails if reviewers must inspect raw conversation logs to parse intent. Reviews stall when context is missing. Reviewers may also approve blindly. The request must supply discrete, validated data points.
Every approval request dispatched by the agent contains two primary fields:
- A concise summary string displayed directly in the human reviewer queue.
- A structured JSON
evidencepayload containing the exact parameters of the downstream action.
Structured JSON preserves auditability. Payloads validate against strict schemas. Records remain queryable over time.
POST /v1/approvals
Host: api.agentdraft.io
Authorization: Bearer avs_live_948f217bca821034e4f8d
Content-Type: application/json
{
"summary": "Execute wire transfer of $4,500.00 to Vendor 1042",
"evidence": {
"action_type": "bank_wire",
"vendor_id": "vend_1042",
"recipient_iban": "GB29NWBK60161331926819",
"amount": 450000,
"currency": "USD",
"invoice_reference": "INV-2026-0881"
}
}
The response returns a unique identifier and initial status:
HTTP/1.1 201 Created
Content-Type: application/json
{
"approval_id": "appr_77a90b41c6d3",
"status": "requested",
"summary": "Execute wire transfer of $4,500.00 to Vendor 1042",
"evidence": {
"action_type": "bank_wire",
"vendor_id": "vend_1042",
"recipient_iban": "GB29NWBK60161331926819",
"amount": 450000,
"currency": "USD",
"invoice_reference": "INV-2026-0881"
},
"created_at": "2026-12-01T14:32:00Z",
"resolved_at": null,
"decision_note": null
}
AgentDraft agents authenticate with bearer API keys prefixed avs_live_, stored argon2id-hashed. Password hashing parameters follow RFC 9106. Each key carries explicit scopes (availability:read, bookings:read, bookings:write, mailbox:read, mailbox:write, rules:read, approvals:request); new keys default to availability:read and bookings:write, and approvals:request must be granted per key. If an unprivileged agent attempts to open an approval request without explicit authorization, the API returns a 403 Forbidden response.
The requesting agent decides for itself when to open an approval request. AgentDraft does not yet provide a policy engine that auto-requires approval by action class, amount threshold, or role, and there are no escalation chains or multi-approver quorums. A single workspace human resolves each request.
Gating agentic tool calls: where to put the check in your loop
Safe execution requires wrapping sensitive tools behind strict functional boundaries. The language model must see only the gated wrapper signature in its registry, without direct access to raw mutation endpoints.
The wrapper manages three core states: approved, denied, or pending.
AgentDraft has integration guides for LangChain, CrewAI, the OpenAI Agents SDK, n8n, and ChatGPT, and an MCP server. It has no package for LlamaIndex or AutoGen; those frameworks call the REST API through a tool the developer writes.
In Python runtimes, tool wrappers intercept model tool invocations directly:
import hashlib
import json
import time
import requests
AGENTDRAFT_API_BASE = "https://api.agentdraft.io"
def execute_wire_transfer_tool(recipient_iban: str, amount_cents: int, vendor_id: str, api_key: str) -> dict:
payload = {
"action_type": "bank_wire",
"vendor_id": vendor_id,
"recipient_iban": recipient_iban,
"amount": amount_cents,
"currency": "USD"
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
req_body = {
"summary": f"Wire transfer of ${amount_cents / 100:.2f} to {vendor_id}",
"evidence": payload
}
response = requests.post(f"{AGENTDRAFT_API_BASE}/v1/approvals", json=req_body, headers=headers)
if response.status_code != 201:
return {"error": f"Failed to register approval gate: {response.text}", "status": "failed"}
approval = response.json()
approval_id = approval["approval_id"]
wait_time = 2.0
max_wait = 60.0
elapsed = 0.0
while elapsed < max_wait:
poll_resp = requests.get(f"{AGENTDRAFT_API_BASE}/v1/approvals/{approval_id}", headers=headers)
if poll_resp.status_code == 200:
current_state = poll_resp.json()
if current_state["status"] == "approved":
return perform_actual_wire_transfer(recipient_iban, amount_cents, vendor_id, approval_id)
elif current_state["status"] == "denied":
return {
"status": "denied",
"reason": current_state.get("decision_note") or "Action rejected by human reviewer."
}
time.sleep(wait_time)
elapsed += wait_time
wait_time = min(wait_time * 1.5, 10.0)
return {"status": "timeout", "error": "Human review timed out. Action was not executed."}
def perform_actual_wire_transfer(recipient_iban: str, amount: int, vendor_id: str, approval_id: str) -> dict:
return {"status": "success", "tx_id": "tx_9921", "approval_id": approval_id}
Denials are operational outcomes. When an approver rejects a request, the tool wrapper exits cleanly, records the rejection rationale, and returns control to the agent without throwing uncaught exceptions. If an agent treats rejections as unhandled exceptions, its retry loop may flood reviewers with duplicate tickets.
Idempotency is required. Calculate an action hash from the evidence payload. If a worker drops connection and retries the tool call, it checks the pending approval ID instead of creating another record.
Polling versus webhooks: picking the wait path
Teams waiting for approval decisions choose between synchronous polling and asynchronous webhooks. Your job runtime determines the right approach.
Polling GET /v1/approvals/{approval_id} fits short review windows. Configure exponential backoff and set an absolute timeout cap. Worker threads deadlock when left waiting without explicit timeouts.
Webhooks decouple distributed task queues. The agent persists its state to a local store and releases worker threads. When a reviewer resolves the ticket, the platform dispatches an approval.approved or approval.denied event to your handler.
AgentDraft signs every webhook delivery with an X-AgentDraft-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256> header computed over <t>. followed by the raw request body, using the workspace's signing secret. The receiver verifies it; AgentDraft recommends that receivers reject any timestamp more than 300 seconds (5 minutes) from the current time to block replays, and its documented reference verifier does so. Signed webhook delivery is available on every plan, including the free Developer tier.
HMAC verification matches the IETF RFC 2104 specification. The following Node.js sample validates this header:
const crypto = require("crypto");
function verifyWebhook(rawBodyBuffer, signatureHeader, signingSecret) {
if (!signatureHeader) {
throw new Error("Missing X-AgentDraft-Signature header");
}
const parts = signatureHeader.split(",");
let timestamp = null;
let receivedHmac = null;
for (const part of parts) {
const [key, val] = part.split("=");
if (key === "t") timestamp = parseInt(val, 10);
if (key === "v1") receivedHmac = val;
}
if (!timestamp || !receivedHmac) {
throw new Error("Malformed signature header elements");
}
const currentTime = Math.floor(Date.now() / 1000);
if (Math.abs(currentTime - timestamp) > 300) {
throw new Error("Webhook delivery rejected: timestamp drift exceeds 300 seconds");
}
const signedPayload = `${timestamp}.${rawBodyBuffer.toString("utf8")}`;
const computedHmac = crypto
.createHmac("sha256", signingSecret)
.update(signedPayload)
.digest("hex");
const receivedBuffer = Buffer.from(receivedHmac, "hex");
const computedBuffer = Buffer.from(computedHmac, "hex");
if (
receivedBuffer.length !== computedBuffer.length ||
!crypto.timingSafeEqual(receivedBuffer, computedBuffer)
) {
throw new Error("HMAC signature verification failed");
}
return true;
}
Verify the raw buffer directly. JSON deserialization modifies whitespace, character escapes, and key order, which breaks signature checks.
Approval gate implementation: the state machine and its edge cases
A production gate manages four distinct lifecycle states: requested, approved, denied, and timed_out. Explicit rules govern every transition.
| State | Trigger | System Action | Audit Evidence Collected |
|---|---|---|---|
requested | Agent invokes tool wrapper | Create record, yield or poll loop | Timestamp, agent identity, evidence JSON |
approved | Dashboard reviewer accepts | Execute downstream side effect | Reviewer ID, approval note, completion timestamp |
denied | Dashboard reviewer rejects | Halt action, inform agent runtime | Reviewer ID, rejection rationale note |
timed_out | Max wait interval expires | Default-deny, release resources | Timeout interval, system cancellation log |
Approvals are decided in the AgentDraft dashboard. AgentDraft emails the workspace owner a notification linking to the queue, but the decision itself is made signed in. There are deliberately no approve-from-email links, because an unauthenticated one-click approve is an attack surface. Slack, Discord, Teams, SMS and push delivery are not available today.
Humans sign in to the dashboard with a passkey (WebAuthn), with a magic link as the bootstrap and recovery path. Hardware-backed credentials satisfy the FIDO2 / WebAuthn standard. Reviewers are authenticated human operators.
Workers must avoid duplicate execution upon resumption. If an application polls and receives webhooks simultaneously, a delayed delivery can cause dual execution paths. Ensure downstream idempotency by using a unique mutation key derived from the approval_id. If a worker receives an approval callback for an action that already executed, it ignores the duplicate event.
AgentDraft records state-changing agent actions in an append-only audit trail. Audit retention is per-tier and enforced on read as well as on write, so the retention claim holds even though deletion is lazy.
What the audit record must contain to survive an auditor
An audit log must prove who initiated an action, what arguments were passed, who authorized it, and how the downstream job completed. A simple log entry stating that a job finished will fail external review.
A production audit record tracks seven discrete properties:
- The agent identity and hashed credential key (
avs_live_...). - The exact ISO 8601 timestamp when the request opened.
- The unmodified JSON evidence payload.
- The authenticated identity of the dashboard reviewer.
- The decision timestamp and optional human note.
- The external entity identifier, such as a
booking_idormessage_id. - The downstream execution status code.
Store the approval_id alongside external resources. When an agent schedules a meeting, map the booking_id back to the approval_id. When it sends an email, persist the message_id in that same record.
AgentDraft's audit trail is append-only and is not hash-chained today; hash chaining is planned. Approval receipts are signed with Ed25519 on Team and above.
AgentDraft does not hold formal compliance certifications (SOC 2, HIPAA, ISO 27001, etc.). It does keep an append-only audit trail. If external compliance policies mandate long data retention windows, select your plan tier accordingly.
Failure modes that show up only in production
Production deployments expose operational corner cases. Planning for these failures keeps systems stable under live traffic.
Approval fatigue
Reviewers face alert fatigue when agents gate routine, low-risk queries. People begin approving entries blindly. Restrict approval gates to destructive, outbound, or financially binding actions. Read-only queries should execute without human intervention.
Stale evidence payloads
World state changes while requests sit in review queues. If an agent requests approval to book an open calendar slot, another user might claim the slot before human review finishes.
AgentDraft coordinates holds and commits through a priority-aware conflict engine so multiple agents can act on the same calendar without double-booking. AgentDraft's conflict engine locks time in five-minute buckets: a 30-minute booking writes 6 bucket rows, and the 480-minute maximum booking spans 96.
Conflicts are resolved at the storage layer. A booking writes one time-bucket row per 5-minute bucket inside a single transaction. Under the hood, this transaction uses DynamoDB writes where batch sizing is strictly bounded. DynamoDB transaction limits cap writes at 100 items per call, as documented in the AWS DynamoDB TransactWriteItems specification.
AgentDraft holds expire after 30 seconds by default. A booking request cannot set its own hold TTL. A committed booking can be bumped by a higher-priority agent only within a 30-second window, after which it is frozen. A single booking is capped at 480 minutes (8 hours), buffers included, and at 99 five-minute buckets per request; a longer request is rejected with 422 booking_too_long. The cap is service-wide; no workspace or plan setting raises it.
Verify external preconditions upon receiving an approval token before triggering the mutation.
Rate limits and errors
Under traffic spikes, agents must handle platform limits without dropping pending jobs. Defined in RFC 6585, HTTP status code 429 indicates that a client exceeded rate limits. AgentDraft answers a rate-limited request with 429, a Retry-After header, and a retry_after_seconds field in the JSON body. It does not send X-RateLimit-* headers. Clients must read the delay value directly from the Retry-After header or the JSON response body.
Blast radius isolation
Autonomous agents operating on external services require domain boundaries. AgentDraft gives AI agents per-agent email inboxes with inbound webhooks, replies, and audit evidence. The number of inboxes a workspace can run at once is set by plan: 1 on Developer and Individual, 5 on Team, 25 on Scale, unlimited on Enterprise.
AgentDraft's free Developer tier includes one mailbox, which the workspace owner can move between its 3 agents; giving several agents their own inbox at the same time needs Team (5 mailboxes) or above. Per-agent mailboxes isolate blast radius. A malfunctioning agent loop burns its own mailbox quota, protecting external domain reputation.
Choosing where to run the gate
Teams choose between building an internal approval engine and using a dedicated API.
Maintaining in-house gating requires building an authenticated dashboard, handling WebAuthn passkeys, managing signed webhook pipelines, and storing durable audit trails. These tasks draw engineering capacity away from core platform features.
Evaluate approval backends against four criteria:
- The registration endpoint returns an immutable, distinct approval ID.
- Human approval requires verified dashboard credentials.
- Webhooks arrive with cryptographic HMAC signatures.
- Audit records are append-only and accessible through the retention window.
AgentDraft's agent-facing REST API is served from https://api.agentdraft.io. Calendar: GET /v1/availability returns open slots, POST /v1/bookings takes a hold or a commit (mode), DELETE /v1/bookings/{booking_id} cancels, and POST /v1/holds/{hold_id}/release drops a hold. Mailbox: GET /v1/mailbox/messages, GET /v1/mailbox/messages/{message_id}, POST /v1/mailbox/send, and POST /v1/mailbox/messages/{message_id}/reply. Approvals: POST /v1/approvals and GET /v1/approvals/{approval_id}. There are no event-update, free-busy, or slot-suggestion endpoints, and no paths under /v1/calendar, /v1/calendars, /v1/inboxes, or /v1/email.
Enterprise SSO (SAML/SCIM via WorkOS) is on the AgentDraft roadmap and not available today; agents authenticate with bearer API keys and humans with passkeys. AgentDraft is a proprietary hosted API; it is not open source and is not offered as a self-hosted or on-premise product. AgentDraft syncs Google Calendar today; Microsoft 365 / Outlook calendar sync is planned, not yet shipped.
Select a tier that matches operational demand. See the AgentDraft pricing page for full tier specifications. The free Developer plan includes 3 agents, 1 mailbox, and 7-day retention. The Team plan provides 5 mailboxes, 10,000 monthly bookings, and longer audit retention.
A minimal end-to-end sequence
A complete gate sequence runs five steps:
- The agent serializes action parameters into an evidence JSON payload and calls
POST /v1/approvalsusing a bearer token with theapprovals:requestscope. - The agent records the returned
approval_idlocally, pausing worker execution on a polling loop or awaiting anapproval.*webhook. - If the status resolves to
approved, the worker wakes up, verifies that state preconditions hold, performs the mutation, and stores theapproval_idbeside the resulting entity ID. - If the status resolves to
denied, the agent terminates the execution path, logs the reviewer note into session context, and stops retrying. - If the review interval passes the maximum wait threshold, the agent records an expiration event, executes a default-deny branch, and logs the timeout.
Frequently asked questions
How to require approval for AI agent actions?
To require approval for AI agent actions, intercept the execution loop at the tool level. Prompts do not halt tool execution reliably. Inside the tool wrapper, issue a request to POST /v1/approvals containing a summary and an evidence payload, and halt downstream execution until the approval state resolves to approved via polling or an incoming signed webhook.
How to add human approval to AI workflows?
To add human approval to AI workflows, isolate sensitive operations behind function call wrappers that return approved, denied, or pending states. Expose only the wrapped function signature to your agent framework (such as LangChain, CrewAI, or the OpenAI Agents SDK), record the action in a centralized approval queue, and resume workflow execution only after a verified human resolves the pending request.
How do I require approval for AI agent actions without blocking the whole agent loop?
Use an asynchronous webhook architecture instead of synchronous thread sleeping. When the agent initiates an action, write the intermediate execution context to persistent storage alongside the generated approval_id, and terminate the immediate worker task. When an approval.approved webhook arrives, use the payload to locate the stored context and resume execution on an available worker.
What HTTP status codes and headers does an approval gate need to handle?
A resilient approval integration must handle 201 Created on request registration, 200 OK during status checks, 403 Forbidden for missing scopes, and 429 Too Many Requests under rate limiting. When receiving rate-limit errors, parse the wait duration from the Retry-After header and the retry_after_seconds JSON response field.
Can an approver approve from Slack or email instead of the dashboard?
Approvals are decided in the AgentDraft dashboard. AgentDraft emails the workspace owner a notification linking to the queue, but the decision itself is made signed in. There are deliberately no approve-from-email links, because an unauthenticated one-click approve is an attack surface. Slack, Discord, Teams, SMS and push delivery are not available today.
The gate is a status code, not a policy document
An approval gate is a protocol boundary: the agent submits parameters, yields execution, verifies human authorization, runs the mutation, and writes the decision to an audit log. When an action is denied, execution stops before side effects run. When approved, downstream mutations tie directly to authenticated human credentials.
The requesting agent decides for itself when to open an approval request. AgentDraft does not yet provide a policy engine that auto-requires approval by action class, amount threshold, or role, and there are no escalation chains or multi-approver quorums. A single workspace human resolves each request. AgentDraft's audit trail is append-only and is not hash-chained today; hash chaining is planned. Approval receipts are signed with Ed25519 on Team and above.
AgentDraft's Developer tier is free with no card required: 1 seat, 3 agents, 1 mailbox, 1 connected calendar, 50 bookings a month, and 7-day audit retention. Developer-tier outbound email must reply within a booking thread and is capped at 5 sends per agent per day. Signed webhook delivery is included on the Developer tier, so a free workspace is a working sandbox for testing webhook handlers. View tier limits and create a free workspace at https://agentdraft.io/pricing.
Liked this? One short note every other Tuesday.
Conflict-engine post-mortems, new endpoints, the rare opinion. No tracking pixels.
Double opt-in: you'll get a confirmation link. Unsubscribe in one click.
Read this beat regularly? Add AgentDraft as a preferred source on Google →