Practical guide · Agent safety
How to design approval gates for AI agents
An approval gate should stop a consequential tool call before its side effect, show an authorized reviewer the exact action and arguments, and resume only the approved call once. Start with business impact and reversibility. Then design identity checks, state storage, expiry, replay protection, rejection behavior, and evidence around that boundary.
Published November 19, 2026 · 9 minute read
The short answer
Require approval when an agent can create an external commitment, move money, publish or send content, change permissions, delete or overwrite durable data, disclose sensitive information, deploy code, or cross a scope the user did not already authorize. Let low-risk, reversible, read-only actions proceed under deterministic policy. Every request should show the target, operation, arguments, expected effect, data involved, requesting user, agent version, and expiry. Recheck authorization at execution time and make the action idempotent.
Use a risk matrix, not a prompt
The model should not decide whether its own action is safe. Define approval policy in application code or a separate policy service, and enforce permissions again in the downstream system. OWASP calls excessive functionality, permissions, and autonomy the roots of excessive agency. Its mitigations include least privilege, acting in the user's security context, human approval for high-impact actions, and authorization outside the model.
| Action class | Default | Reason |
|---|---|---|
| Public, read-only lookup | Allow within scope | Low direct impact, provided network and data rules still apply. |
| Draft or reversible local change | Allow in an isolated workspace | The result can be reviewed before it reaches another system. |
| External message or publication | Approve exact recipient and content | The action represents the user or organization outside the agent. |
| Money, purchase, refund, or contract | Approve with amount and policy limits | It creates a financial or legal commitment. |
| Delete, permission, credential, or production change | Approve, or prohibit entirely | Impact can be broad, hard to reverse, or security-sensitive. |
| Sensitive data transfer | Approve destination, fields, and purpose | A harmless-looking tool call can expose confidential information. |
Add thresholds within a class. A support agent might issue a small refund under a policy and require a manager above that limit. A deployment agent might update a disposable preview automatically while every production deployment requires a release approver.
Design the approval record
A button labeled "Allow" is too little information. Store a server-owned request containing the immutable call ID, tool identity, normalized arguments, target resource, requesting user and tenant, agent and policy versions, risk reason, creation time, expiry, and a digest of the proposed action. Show the reviewer a readable rendering of those same fields.
- Authenticate the reviewer. Do not accept a user ID supplied in the approval body.
- Authorize the decision. Possessing a request URL or opaque ID does not grant authority over the target account, amount, or environment.
- Bind the decision to one call. Editing a recipient, query, amount, file path, or environment creates a new request.
- Expire stale requests. Recompute policy and downstream authorization immediately before execution.
- Consume atomically. Only one worker should move a pending request into an executing state.
- Record the outcome. Keep reviewer identity, decision, comment, execution result, side-effect identifier, and timestamps in append-only audit storage.
OpenAI's Agents SDK human-in-the-loop guide warns that serialized run state is not authenticated, recommends server-controlled storage and reviewer authorization, and notes that an approved call is not automatically exactly-once. That last point matters for payments, messages, and any API where retrying can duplicate the side effect.
Implement pause, decision, and resume
1. Intercept before the side effect
Normalize and validate the proposed arguments, evaluate the policy, persist the pending call, and stop before opening a transaction or invoking the external API.
2. Collect an explicit decision
Support approve and reject. Add edit only when the interface validates the full tool schema and turns the edit into a new, reviewable call. LangChain's human-in-the-loop overview distinguishes approve, edit, reject, and respond decisions, and documents per-call decisions keyed to interrupt IDs.
3. Resume from trusted state
Load the server-owned record, verify the decision and expiry, claim it atomically, recheck policy, and execute the stored call. Google ADK's tool confirmation documentation supports boolean and structured confirmations, including conditional thresholds. Its remote resume flow requires matching call and invocation identifiers.
4. Make the side effect idempotent
Send a stable idempotency key where the downstream API supports one. Otherwise, store a unique business operation ID and reject a second execution before creating the side effect. Persist the downstream receipt so a worker can recover after a crash without guessing whether the action happened.
Worked example: a production deployment
A release agent proposes deploying commit 8ab41c2 to production after the test suite passes. Policy lets it create and update disposable previews, but production always pauses for a release approver.
The approval card shows the repository, immutable commit, environment, changed services, migration plan, test and security results, current production version, rollback target, and the policy that caused the pause. The approver cannot swap the commit or environment inside the card. Any change creates a new request with fresh evidence.
After approval, the worker checks that the commit is still reachable from the protected branch, required checks still refer to that commit, the approver still has production authority, and no newer release holds the deployment lock. It claims the request, deploys the stored commit under one release ID, records the platform's deployment receipt, and marks the request complete. If the worker crashes, recovery reads the release state before deciding whether to resume or roll back.
Test rejection, replay, and recovery
- Prove that a gated tool cannot execute before a decision and that rejection never invokes it.
- Change one argument after approval and require a new decision.
- Submit the same approval twice in parallel and allow only one execution claim.
- Expire a request, revoke the reviewer's role, or change the target permission while paused. Resume must fail closed.
- Crash after the external service succeeds but before local completion is stored. Recovery must use the idempotency key or receipt without duplicating the action.
- Feed model-generated HTML, misleading labels, hidden instructions, and very long arguments into the approval UI. Escape content and keep security-relevant fields visible.
- Verify that audit events survive agent and workspace deletion, and that the agent cannot alter them.
Add these cases to the normal agent test set and the adversarial suite. Approval behavior can regress when tool schemas, middleware order, identity handling, or persistence changes.
Where approval gates fail
- Approval fatigue turns a security control into a reflex. Remove low-risk prompts and reserve interruption for consequential decisions.
- A reviewer cannot assess a vague summary. Show the actual target and arguments, plus the information needed to understand impact.
- Approvals do not replace least privilege, sandboxing, validation, rate limits, or downstream authorization.
- A blanket "always allow" decision can outlive the context in which it was safe. Scope durable decisions to a tool, identity, resource boundary, policy version, and short expiry.
- Human review cannot fix a workflow whose volume or response-time target makes meaningful review impossible. Reduce autonomy or redesign the service boundary.
Approval-gate checklist
- □ Policy code, rather than the model, decides which calls pause.
- □ The gate sits before the external side effect.
- □ The reviewer sees the exact target, operation, arguments, identity, impact, and expiry.
- □ Reviewer authentication and authorization are checked server-side.
- □ A decision is bound to one immutable call and expires.
- □ Resume reloads trusted state and rechecks current policy.
- □ Atomic claiming and idempotency prevent duplicate execution.
- □ Rejection, timeout, revocation, concurrent approval, crash recovery, and audit integrity are tested.