By the end of this guide, an agent or backend service can issue a third-party call that pauses for explicit human approval before executing. The approver clicks a link, reviews the request, approves or denies, and the application gets the eventual result. The flow:Documentation Index
Fetch the complete documentation index at: https://docs.alterauth.com/llms.txt
Use this file to discover all available pages before exploring further.
- An agent or backend issues
proxy_request()for a sensitive call. - Alter routes through the approval pipeline and returns a
PendingApprovalimmediately. - The application surfaces the approval link to the designated approver (in-app, by email, in chat).
- The approver approves or denies in the Wallet.
- The application polls or awaits the outcome and receives the eventual provider response (or an
ApprovalDeniedError).
Prerequisites
- An app with an approval-enabled grant or agent. Approvals are configured on the policy attached to the grant or agent.
- A way to surface the approval URL to the approver — most apps render it as a notification, send a DM, or open a modal.
Walkthrough
1. Configure the approval policy
In the developer portal: pick the agent or managed-secret grant the approval should gate, open Policy → Require approval, and add the approver(s). Each call against the policy now pauses for approval.2. Issue the request via proxy_request
proxy_request is the variant of request that runs through the approval pipeline. If the policy requires approval, the call returns a PendingApproval instead of a provider response:
reason field is recorded in the audit log and shown to the approver, alongside the request payload.
3. Wait for the decision
Two surfaces for collecting the outcome: Await inline — block until approved/denied/expired (with a timeout):pending.approval_id and poll status from a worker:
Patterns
Surfacing the approval link
ThePendingApproval.approval_url is a deep link to the Wallet’s approval view. Most apps render it as:
- An in-app banner with Approve / Deny buttons opening the URL.
- A Slack DM to the configured approver.
- A push notification with the URL as the action.
- An email (when an email provider is configured at the app level; otherwise the URL is the only delivery).
Distinguishing pending from immediate
proxy_request may return either PendingApproval (policy required approval) or an ApprovalResult (no approval needed; the call ran synchronously). Branch on the return type:
Recording why the approval was requested
reason is the single most useful field for the approver. Write a concrete sentence — “Refund $X to customer @ for ticket #Y” — not a generic “agent action.” The audit log preserves the reason permanently.
Troubleshooting
| Error | Likely cause | Fix |
|---|---|---|
ApprovalDeniedError | The approver clicked Deny. | e.details includes the approver’s reason if provided. |
ApprovalExpiredError | The approval window elapsed (default 1 hour, configurable on the policy). | Re-issue the call. Adjust the policy’s window if too short. |
ApprovalTimeoutError | The SDK’s local wait timed out; the row may still be pending. | Persist approval_id and re-poll. |
ApprovalExecutionFailedError | The approver approved, but the provider call failed at execution time (grant revoked between approval and execution, provider error, etc.). | Inspect e.details. |
PendingApproval never resolves | No approver was notified. | Verify the policy’s approver list and the application’s notification path. |
What’s next
Policies
Approval is one policy type among several.
Wallet
Where approvers see and act on requests.
Errors
The full approval error hierarchy.