Guides
Add Human-in-the-Loop Approvals
Gate sensitive third-party calls behind an explicit approval, polled or awaited from the application.
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:
- An agent or backend issues
proxy_request()for a sensitive call. - Alter routes through the approval pipeline and returns a
PendingApprovalimmediately. - The application surfaces each approval-gate link to its 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
Section titled “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
Section titled “Walkthrough”1. Configure the approval policy
Section titled “1. Configure the approval policy”“Require human approval” is the operator authoring label for the require_approval runtime-policy rule type — the same evaluator, audit rows, and approvals queue whichever surface authors it. In the developer portal there are two ways to turn it on. For every call through one grant, open the grant’s editor and enable the Human-in-the-loop approval block, adding the approver. For only some calls, or for a gate above one grant (agent-, provider-, or app-wide), open that agent’s, provider’s, grant’s, or app’s Runtime policies section, click Add runtime policy, choose the Require human approval type, set the condition, and add the approver. From the CLI the two are alter managed-secrets grants create <provider> … --grant-policy @file.json (or grants update <grant-id> --grant-policy @file.json) for the grant block and alter policy rules create --type require_approval for a rule — see Set policies. Each call the gate matches now pauses for approval. A rule’s approver list is any-of: every listed person is notified and the first decision counts, in the Wallet or through the API. Changed: before any-of, only the first listed approver of a rule was notified and could decide; now every listed approver is notified and any one of them may decide. A rule that listed several addresses to record alternates, not to widen who may decide, should keep one approver. To require several people to approve, create distinct approval rules with distinct approver sets at applicable policy levels. Alter combines those into separate gates and executes only after every gate approves. Each approver’s decision is recorded as its own approval.granted or approval.denied audit event naming that approver, on the same trace as the request it decides.
A managed-secret grant has no default approver, so enabling approval on one requires at least one explicit approver email — a save without one is rejected on every authoring surface (the portal’s grant editor and policy-rule forms, the CLI, and the backend with a structured error) rather than failing later at the grant’s first use. OAuth grants may leave the list empty; approval then defaults to the grant’s resource owner — the end user who connected the account. When an agent calls through a grant that user delegated to it, the approval still goes to that user, never to the agent or to whoever made the call. An approval that defaults to the resource owner is decided only by that person, in the Wallet; the approvals API refuses it (see which approvals the API can decide). A connection that no end user connected has no owner to default to: a gated call on it is refused with approval_config_error, and the rule needs an explicit approver. An agent-level approval rule may also leave the list empty for OAuth use, but the save warns that any managed-secret grant the agent serves would be denied at runtime until an explicit approver is added.
Approver addresses are checked against the identity provider’s directory when the rule is saved. An address the directory does not have is refused (approver_not_found). When the directory cannot be asked (the identity provider has no directory management credential, or the lookup failed), the rule is saved with a warning (approver_warnings on the result, printed on stderr by the CLI), and that address is checked only when someone decides:
- In the Wallet, only a person who signs in through the application’s identity provider with that email verified can decide. An address nobody can sign in as can never decide there.
- Through the approvals API with
actor_email, Alter checks only that the address is one of the request’s approvers and records the decision asasserted_by_integration. The application is trusted to have verified the person; Alter does not check the address against the directory.
So a mistyped or unknown address on a rule saved with a warning can be decided only by an integration that names it. Fix the address, or add the directory management credential so the save can check it.
A grant has two approval-authoring surfaces that coexist: the grant editor’s Human-in-the-loop approval block (the baseline gate — one unconditional requirement, replaced as a whole each time the grant’s settings are saved, and reflected back when the editor reopens) and policy rules (named, optionally conditional approval rules, added in the Runtime policies section, the wallet, or alter policy rules create --type require_approval). Saving the settings block never touches the rules, and vice versa — turning the block off removes only the baseline gate, and each additional rule remains its own independent gate. The block’s enforcing rule appears in the rules list labelled “managed by the grant’s settings”; edit it through the settings, not the rules editor.
2. Issue the request via proxy_request
Section titled “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:
from alter_sdk import Agent, HttpMethodfrom alter_sdk.models import PendingApproval
agent = Agent(api_key=os.environ["AGENT_API_KEY"])
pending = await agent.proxy_request( HttpMethod.POST, "https://api.stripe.com/v1/refunds", grant_id=STRIPE_GRANT_ID, json={"charge": "ch_abc"}, reason="Customer requested refund per ticket #1234",)
if isinstance(pending, PendingApproval): # One gate is typical; N-of-N policies return one link per gate. for gate in pending.gates: await notify_approver(gate.approval_url)import { Agent, HttpMethod, PendingApproval } from "@alter-ai/alter-sdk";
const agent = new Agent({ apiKey: process.env.AGENT_API_KEY! });
const pending = await agent.proxyRequest({ method: HttpMethod.POST, url: "https://api.stripe.com/v1/refunds", grantId: STRIPE_GRANT_ID, json: { charge: "ch_abc" }, reason: "Customer requested refund per ticket #1234",});
if (pending instanceof PendingApproval) { for (const gate of pending.gates) { await notifyApprover(gate.approvalUrl); }}The reason field is recorded in the audit log and shown to the approver. For cataloged provider operations, the Wallet also shows the attested operation name and security-relevant projected values (for example, a payment amount and recipient) before the decision. For a request to a custom API, or one no operation catalog describes (an endpoint the catalog does not cover), the approver sees what the agent sends (and, when a custom API’s request matches one of the operations its developers mapped, that operation’s name and families beside it): every value of the request, named by where it is sent (body.amount, query.limit, header.stripe-account), exactly as sent, as its JSON literal (the number 1250 and the string "1250" read differently). An approval is consent to exactly what executes, so nothing is hidden on account of its name. Alter’s own credential for the grant is never part of the agent’s request — Alter adds it after approval, and an agent cannot send Authorization or Cookie — so it is never shown. The only values listed by name without their value are the transport sign-in headers Authorization, Proxy-Authorization and Cookie, and the headers or query parameters Alter fills with the grant’s credential. An agent cannot set those: a request that puts a value in one is refused with a 422 and the error credential_slot_in_request, naming the field, and Alter removes every such field from every proxied request (approved or not) before it adds the credential, so it carries Alter’s value or nothing. If the grant’s credential settings change after approval so that Alter would fill a field the approved request sets, the approved request fails instead of running differently from what was approved. A request whose values cannot all be shown faithfully is refused when it is made, with a 422 and the error approval_request_unsupported naming the field and the reason, so no approval is created that nobody could approve: more than 1,000,000 characters of field names and values together (counted on the values themselves; escapes added for display do not count), nesting deeper than 32 levels, or two fields that would be shown under the same name (such as headers differing only in case). Long values and many fields are otherwise shown in full: the Wallet shows every value, in a scrollable block, and never shortens one. A request to a cataloged operation is refused the same way when its parameters cannot be read because of the request itself, such as a body that is not a JSON object, a Content-Type the operation is not read from, or a missing or wrongly typed field. An approval created before this check that cannot be shown is marked not approvable in the Wallet, which names the field and the reason. The query string is shown as Alter sends it to the provider: a ; is part of a value, an invalid percent-escape such as %ZZ is sent, and shown, as its literal text, and a valid escape of a byte that is not UTF-8 (such as %FF) is sent, and shown, as the replacement character �. Each query parameter is shown on its own, a repeated one as the list of its values in the order they are sent. A parameter any of whose values contains + on the wire (read as a space by some servers and as a plus by others) is shown as its exact encoded text, every value in order, under query.<name> (encoded, as sent), with its name also exactly as sent; its values count toward the character bound by the characters they decode to. Each value of a repeated parameter is shown and counts toward the character bound. Invisible and text-direction control characters are shown as visible escapes.
If the frozen request cannot be integrity-checked or its security-relevant values cannot be projected, the Wallet keeps Deny available but blocks Approve. The request must be retried after the context is available. When only a newer Wallet page could show every value of the request (the approver has an older page open), the Wallet says the page is out of date and offers a reload instead; Deny still works without reloading.
3. Wait for the decision
Section titled “3. Wait for the decision”Two surfaces for collecting the outcome:
Await inline — block until approved/denied/expired (with a timeout):
from alter_sdk import ApprovalDeniedError, ApprovalExpiredError, ApprovalTimeoutError
try: result = await agent.await_approval(pending.approval_id, timeout=300) # result.status_code is the provider response status # result.body_json() decodes the response body refund = result.body_json()except ApprovalDeniedError as e: log.info("Approver denied", approval_id=e.approval_id)except ApprovalExpiredError: log.info("Approval window elapsed before decision")except ApprovalTimeoutError: # The SDK gave up waiting; the approval may still be pending passimport { ApprovalDeniedError, ApprovalExpiredError, ApprovalTimeoutError,} from "@alter-ai/alter-sdk";
try { const result = await agent.awaitApproval(pending.approvalId, { timeoutMs: 300_000 }); const refund = result.bodyJson();} catch (e) { if (e instanceof ApprovalDeniedError) { /* … */ } else if (e instanceof ApprovalExpiredError) { /* … */ } else if (e instanceof ApprovalTimeoutError) { /* … */ } else { throw e; }}Poll — for longer-running approvals (up to the configured 24-hour maximum), persist pending.approval_id and poll status from a worker:
status = await agent.get_approval_status(approval_id)if status.is_terminal: handle_terminal(status)const status = await agent.getApprovalStatus(approvalId);if (status.isTerminal) handleTerminal(status);Key scopes. The status poll and result fetch accept the same key that made the proxy_request call — a key allowed to initiate the deferred call (proxy:execute) can always follow it to completion, with no additional scope. A monitor-only service that polls approvals without making provider calls uses a key holding approvals:read instead.
Patterns
Section titled “Patterns”Surfacing the approval link
Section titled “Surfacing the approval link”For a single-gate policy, PendingApproval.approval_url is the Wallet deep link. For N-of-N approval, PendingApproval.gates contains every gate’s separate approval_url; deliver each link to that gate’s designated approver. The top-level approval_id remains the handle used to poll or await the combined result. Most apps surface approval links 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 the approval policy selects the email channel and the Alter deployment has email delivery configured; otherwise the URL is the only delivery.
The URL contains no decision credential. The Wallet requires a valid app-user session and only a designated approver can load or decide the request; another authenticated user receives a not-found response. An approval the end user required (through a rule they set on themselves or on their grant, or the resource-owner default) can be decided only there, by that person; an approval the operator required may also be decided through the API. The approver is matched by email, so the identity provider must assert that email as verified (email_verified: true in the sign-in token); a Wallet user whose email the identity provider has not verified cannot load or decide approvals until they verify it and sign in again. Treat the URL as sensitive context and deliver it only to the intended approver.
Distinguishing pending from immediate
Section titled “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:
if isinstance(result, PendingApproval): handle_async(result)else: handle_immediate(result) # ApprovalResult — body is the provider responseThis means an approval policy can be enabled or disabled per-grant without changing application code; the call site handles both paths.
Recording why the approval was requested
Section titled “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 approval audit event includes the reason.
Deciding through the API
Section titled “Deciding through the API”The Wallet is one way to decide a held request. An application that already has reviewers somewhere else — a chat bot, an internal review tool, a ticketing system — can decide on a person’s behalf through the SDK, the CLI, or the REST route behind them. The person must be one of the request’s approvers; the application names them one of two ways, and Alter records which:
- Asserted by the integration. The application passes the person’s email (
actor_email/actorEmail). Alter checks it against the request’s approvers — an email that is not one gets the sameapproval_not_foundas an unknown id — and records the decision withactor_assurance: asserted_by_integration. Use this when the application has authenticated the reviewer itself. - Verified by Alter. The application passes the person’s ID token from the application’s identity provider (
actor_token/actorToken). Alter validates it like a Wallet sign-in and recordsverified_by_alter. This is the only way an API caller can decide a request whose rule requires step-up. Know its limit:verified_by_altermeans the integration presented a valid, unexpired ID token for that person; it does not prove that the person consented to this specific decision. An application that holds a user’s tokens can decide in their name, so the approver’s Wallet shows such a decision as made “through the application’s integration”, apart from one they clicked themselves.
The key that decides is an application key carrying approvals:decide — a scope no wildcard grants and no agent key can hold. Minting or rotating any API key, this one included, is an organization-admin action in the developer portal, the CLI and the API. A request made as an agent (agent_cannot_decide) and the key that queued the approval (self_decision_refused) are refused. Approving needs the summary_version the person was shown; denying never does. The status read and the list serve the summary in the shape the caller asks for (summary_version, default 1) and report that version beside it, and they also report required_summary_version: the lowest version an approve of that request accepts. A plain request needs 1; a request holding sensitive fields, masked values or an upload needs the version that declares them, because approving at a version attests that the person saw that version’s fields. So the recipe is: read the status at the version the reviewer UI renders; if required_summary_version is higher, read it again at that version and show the person the fields it adds (sensitive_fields, masked_values, the upload manifest); then decide at the version shown. alter approvals show always renders the current shape and prints both fields.
status = await app.get_approval_status(approval_id, summary_version=1)if status.required_summary_version > 1: status = await app.get_approval_status( approval_id, summary_version=status.required_summary_version ) print(status.summary) # show the person sensitive_fields / masked_values / uploaddecision = await app.decide_approval( approval_id, decision="approved", actor_email="reviewer@example.com", summary_version=status.summary_version, reason="Reviewed in #payments",)print(decision.decided_by, decision.actor_assurance)let status = await app.getApprovalStatus(approvalId, { summaryVersion: 1 });if (status.requiredSummaryVersion > 1) { status = await app.getApprovalStatus(approvalId, { summaryVersion: status.requiredSummaryVersion, }); console.log(status.summary); // show the person sensitive_fields / masked_values / upload}const decision = await app.decideApproval(approvalId, { decision: "approved", actorEmail: "reviewer@example.com", summaryVersion: status.summaryVersion, reason: "Reviewed in #payments",});console.log(decision.decidedBy, decision.actorAssurance);export ALTER_API_KEY=alter_rk_... # an application key carrying approvals:decidealter approvals decide --approval <approval-id> --approve \ --as reviewer@example.com --summary-version 1 --reason "Reviewed in #payments"A decision counts for the summary the person saw
Section titled “A decision counts for the summary the person saw”A decision is the person’s answer to one summary, so it counts only at the summary_version they were shown. When the summary a request needs changes (approval_summary_version_required, or batch_changed for a batch), nothing is decided: show the person the new summary and wait for them to decide again. Never resend a decision at a newer version on their behalf, from a retry, a loop or an error handler, because that approves fields they never saw. Neither SDK nor the CLI retries a decision.
Which approvals the API can decide
Section titled “Which approvals the API can decide”Who may decide an approval through the API depends on who required it:
- Required by the end user — a rule the end user set in the Wallet, on themselves or on their grant, or a gate that lists no approver and so defaults to the grant’s resource owner. Only that person decides it, in the Wallet. Every API decision on it is refused with HTTP 403
approval_requires_end_user, whether the person is named byactor_emailor byactor_token. A batch that contains any such approval is refused as a whole, before any approval is decided. - Required by the operator — a rule on the organization, the application, a provider, a managed secret, an agent or an identity-provider group, or a rule the operator set on a grant (from the dashboard or the CLI). These can be decided through the API with either an asserted email or a verified token, as above, as well as in the Wallet.
Finding a run’s approvals and deciding them together
Section titled “Finding a run’s approvals and deciding them together”A caller that binds a run_id / thread_id through its request context (context={"run_id": ...} / context: { run_id } on proxy_request) can list what one run is waiting on, and decide a set in one call:
page = await app.list_approvals(run_id="run_42", status="pending")# A list item's summary is the stored one (method, host, path): it never# carries the values a write sends. Read each request's status at one version,# the newest any item needs, and show the person THOSE summaries. A status read# also reports the version a decide needs now, which can rise after the list# (a catalog change), so read again at it until none needs a newer one.version = max((item.required_summary_version for item in page.items), default=1)while True: statuses = [ await app.get_approval_status(str(item.approval_id), summary_version=version) for item in page.items ] needed = max((status.required_summary_version for status in statuses), default=version) if needed <= version: break version = neededfor status in statuses: print(status.summary) # the values the person approves: parameters, sensitive_fields, masked_values, the upload manifestdecided = await app.decide_approval_batch( [{"approval_id": item.approval_id, "request_digest": item.request_digest} for item in page.items], decision="approved", actor_email="reviewer@example.com", summary_version=version,)import { App } from "@alter-ai/alter-sdk";
const app = new App({ apiKey: process.env.ALTER_API_KEY! });const page = await app.listApprovals({ runId: "run_42", status: "pending" });// A list item's summary is the stored one (method, host, path): it never// carries the values a write sends. Read each request's status at one version,// the newest any item needs, and show the person THOSE summaries. A status read// also reports the version a decide needs now, which can rise after the list// (a catalog change), so read again at it until none needs a newer one.let version = Math.max(1, ...page.items.map((item) => item.requiredSummaryVersion));let statuses: Awaited<ReturnType<typeof app.getApprovalStatus>>[];for (;;) { statuses = []; for (const item of page.items) { statuses.push(await app.getApprovalStatus(item.approvalId, { summaryVersion: version })); } const needed = Math.max(version, ...statuses.map((status) => status.requiredSummaryVersion)); if (needed <= version) break; version = needed;}for (const status of statuses) { console.log(status.summary); // the values the person approves: parameters, sensitive_fields, masked_values, the upload manifest}const decided = await app.decideApprovalBatch( page.items.map((item) => ({ approvalId: item.approvalId, requestDigest: item.requestDigest })), { decision: "approved", actorEmail: "reviewer@example.com", summaryVersion: version },);Each item is bound to the request_digest it was read with. If any listed approval changed since — decided, expired, voided or re-issued — nothing flips and the call fails with batch_changed, naming each approval’s current state; read again and decide what is still pending. Approvals the call does not list stay pending, so partial approval is sending the subset. A batch holds at most 200 items. An approve carries one summary_version for the whole batch, so take the highest required_summary_version among the items (every item reports it), read each item’s status at that version, show the person those summaries (a list item’s summary never carries the values a write sends), and send it; a version lower than an item needs is refused with approval_summary_version_required, whose required_summary_version names the version to re-read at. The same 409 can follow a correct read when a custom API’s catalog changed in between (a developer mapped or re-mapped the operation a held request matches, which can add fields the summary must show): read again, show the person the fields of the version now required, and let them decide again (A decision counts for the summary the person saw).
Polling for changes
Section titled “Polling for changes”updated_after (updatedAfter, alter approvals list --updated-after) lists only the approvals whose state changed after an instant, compared at millisecond precision, the precision of every updated_at. Webhooks (Webhooks) are the reliable change feed; use this poll as a fallback, and for executing, which has no webhook event. Observing executing this way is best-effort: a list returns each approval’s current state, so an executing phase shorter than the poll interval is never seen. A change is stamped when it is written but listed only once it commits, so a poll from the last updated_at seen can miss one. Keep the largest updated_at seen as the watermark, poll from the watermark minus 5 minutes (far longer than a state change normally stays uncommitted), and drop rows already seen by (approval_id, status, updated_at). The overlap makes a missed change unlikely; it cannot rule one out.
Hearing about approvals instead of polling
Section titled “Hearing about approvals instead of polling”Register an outbound webhook and the application is told when a request is held (approval.requested, with the approvers, the bound run and the digest), decided (approval.decided, with decided_by and actor_assurance — both null when Alter denied the gate itself because another gate of the same request was denied), expired or voided (approval.expired, with the reason), executed or failed. The Wallet’s detail page shows the same attribution for a decision made through the API — who decided, and whether Alter verified them or the integration asserted them.
Limits
Section titled “Limits”A grant may hold up to 100 pending approvals by default (max_pending on the rule, up to 1,000), and an application 5,000 in all; a call that would exceed either is refused with too_many_pending_approvals naming the cap. An executed result stays readable for 24 hours by default (result_retention_seconds, up to a year); the status read and the approval.executed event carry result_available_until. alter approvals defaults prints the deployment’s current values, including the per-application ceiling.
Sensitive input in approvals
Section titled “Sensitive input in approvals”A binary body cannot be held inside an approval, and a streaming response cannot be approved: a binary proxy_request() is refused with proxy_body_uninspectable (422), and a stream with proxy_stream_approval_required (409). Send JSON through proxy_request(), or send the bytes as an upload.
An upload can be approved. proxy_upload_request() / proxyUploadRequest() returns a pending approval and sends nothing. The approver sees the upload’s size and SHA-256 and that nothing has read the file, then deliver_approved_upload() / deliverApprovedUpload() sends it. Alter verifies every byte in encrypted temporary storage before contacting the provider, so the provider receives exactly what was approved or nothing. See the upload reference.
The more sensitive the call, the more it needs a person’s approval, so a request carrying sensitive input is held for approval like any other. When a managed provider’s reviewed input classification marks a value as sensitive (a password, a tax or national id, a bank or routing number, a date of birth, an uploaded file, a secret):
-
The exact request is held, encrypted. It is stored encrypted at rest with the pending approval, runs exactly as approved, and is deleted after it runs, is denied or expires.
-
The approver never sees the value. The Wallet shows every sensitive field by name with a mask chosen by its kind:
- an identifier shows at most a quarter of its characters: the last four of one with 12 or more characters (
•••• 1234), the last two of one with 8 to 11, and nothing (••••) for a shorter one; ••••-••-••for a date;[file: name.pdf, 2.3 MB]for a file;••••••for a password, a secret or any other value. A field inside a secret (anumberunder apasswordobject) is always fully masked.
Every other value is shown as it will be sent. A form or multipart body is shown field by field, so a sensitive field hides only itself.
- an identifier shows at most a quarter of its characters: the last four of one with 12 or more characters (
-
The approver can tell whether a value changed. Each masked field carries a short fingerprint, scoped to the connection and the field. Two requests on the same connection with the same value in the same field show the same fingerprint; a different value almost always shows a different one. The fingerprint cannot be reversed offline. A value with fewer than eight characters (a date part, a four-digit suffix, a flag) has no fingerprint, because its few possible values could be tried one by one.
-
The value stays out of everything else. It never appears in logs, audit records, payload capture, metrics, error messages or audit exports. Approval audit records name the sensitive fields and their kinds, and record that they were masked;
alter approvals shownames at most 50 of them undersummary.sensitive_fields, andsummary.sensitive_field_countis the total.
A request whose sensitive values cannot be masked (they would change a part of the summary that is not a list of values, or its body cannot be rewritten for display) is never shown partly masked. It is refused when it is made, with approval_request_unsupported (HTTP 422).
Two more cases are refused before any approval exists:
error | When |
|---|---|
sensitive_payment_input_requires_token | The request carries raw card data: a card security code or card-number field, a card object (a number beside an expiry, a security code or object: card), or the same as form fields such as card[number], in the body or the query. For a managed provider, Alter never holds raw card data, even encrypted. Send the provider’s card token instead. Stripe calls return sensitive_input_not_retained for raw card data, the code they have always returned. |
sensitive_input_not_retained | The input cannot be classified (a URL or query that cannot be parsed, a body that is not JSON, form or multipart on an operation with sensitive fields, or form fields that contradict each other), so its sensitive values could not be found to mask. |
The reviewed classification covers managed providers. A Custom API has no reviewed classification, so its approvals show every value as it will be sent.
Earlier releases refused every approval-gated request with a classified sensitive field with sensitive_input_not_retained. Those requests now create a pending approval instead. See Approval creation refusals.
Troubleshooting
Section titled “Troubleshooting”| Error | Likely cause | Fix |
|---|---|---|
ApprovalDeniedError | The approver clicked Deny. | e.message contains the approver’s reason if provided (otherwise a default message); e.details contains only the approval ID. Avoid logging free-form decision text. |
ApprovalExpiredError | Either the approval window elapsed (default 10 minutes, configurable up to 24 hours on the policy), or the request was voided before a decision: the grant it would have used was revoked or expired, the agent that made it was revoked, its managed secret was deleted, the provider connection it was held under lost its authorization for good (its refresh token stopped working, the provider session ended or the provider’s configuration changed) or was reconnected after it broke, or another gate of the same request ended it. The status read’s expiry_reason says which (window_elapsed, grant_revoked, grant_expired, agent_revoked, secret_deleted, connection_lost, sibling_gate), and the Wallet shows a voided request as cancelled. | For a lapsed window, re-issue the call, and adjust the policy’s window if too short. For a voided request, restore what it needed (a new connection, a reconnected account or the agent) before re-issuing; the same request would be voided again. |
ApprovalTimeoutError | The SDK’s local wait timed out; the approval 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.). A request whose connection the user reconnected after it broke (after the request was held) is not run, and its message starts connection_lost:: the approval was given for an authorization that no longer exists. A reconnect of an account whose connection Alter never saw fail is not detected. An approved call reaches the provider at most once: a call that may already have reached the provider is never sent again, unless it is a GET, HEAD or OPTIONS request Alter’s operation catalog names a read with no other effect, and its message starts provider_outcome_unknown:. | Inspect e.message for the failure and e.approval_id (Python) / e.approvalId (TypeScript) for correlation. On provider_outcome_unknown:, check the provider for the call’s effect before making the call again. |
Status poll returns 403 insufficient_scope | The polling key holds neither proxy:execute nor approvals:read. | Poll with the key that made the proxy_request call, or mint the monitor key with approvals:read. The error body names the accepted scopes. |
ApprovalPayloadTooLargeError (HTTP 413 approval_payload_too_large) | The request is too large to hold for approval on this deployment. Nothing was held or sent. | Send a smaller request, or send a file as an upload with proxy_upload_request() / proxyUploadRequest(), whose bytes are delivered after approval. e.limit_chars (Python) / e.limitChars (TypeScript) names the limit. |
ProviderResponseTooLargeError when reading the result | The approved call ran, but the provider’s response is larger than the 5 MiB a result can return, so the result was kept without its body. | e.status_code / e.statusCode and e.headers are the provider’s. Do not re-issue the call to recover: it already ran. A call that needs a large response cannot be approved; it uses proxy_stream_request() / proxyStreamRequest(). |
PendingApproval never resolves | No approver was notified. | Verify the policy’s approver list and the application’s notification path, or register an outbound webhook so the application is told when a request is held. |
approval_not_found from decide_approval / decideApproval for an approval that exists | The named person is not one of the request’s approvers (an outsider is indistinguishable from an unknown id), the key belongs to another application, or the request acts as an agent and names an approval another agent created (an agent sees only its own). | Decide as a listed approver (approvers on the status read or the webhook payload). |
agent_cannot_decide / self_decision_refused | The decision was made by a request acting as an agent, or by the key that queued the approval. | Decide with an application key carrying approvals:decide, acting as the application rather than an agent, other than the key that made the held call. |
key_lineage_unresolvable (HTTP 403) from an API decision | Alter could not trace the rotation history of the deciding key, or of the key that queued the approval, back to its original key, so it cannot confirm the two are different keys. | Decide the approval in the Wallet. |
summary_version_required or approval_summary_version_required | An approve did not say which summary the person saw, or said an older one than the request needs (the 409’s required_summary_version names it). The read may have been correct and a custom API’s catalog changed since. | Read the status again with summary_version set to its required_summary_version, show the person the fields that version adds (sensitive_fields, masked_values, the upload manifest), and let them decide again at that version; never resend their earlier decision. On the CLI, alter approvals show prints required_summary_version; pass it as --summary-version. |
approval_requires_end_user (HTTP 403) from an API decision | The approval was required by the end user — a rule they set on themselves or on their grant, or the resource-owner default — so only that person can decide it. Only a listed approver is told this; anyone else gets approval_not_found (HTTP 404), as for an unknown approval. | Send the approval link to that person to decide in the Wallet. |
step_up_required from an API decision | The rule requires a fresh sign-in and the person was only asserted by email. | Decide with the person’s identity-provider token (actor_token / actorToken / --actor-token). |
batch_changed | At least one listed approval changed since it was read. | Read the run again; the error names each approval’s current state. |
too_many_pending_approvals | The grant’s or the application’s pending cap is full. | Decide or let expire what is waiting, or raise max_pending on the rule within the bounds alter approvals defaults prints. |
| The approver’s Wallet approvals page shows “Your email address has not been verified by your identity provider. Verify it, then sign in again.” | The identity provider did not assert the approver’s email as verified (email_verified: true) in the sign-in token, so the approver cannot be matched. | Have the approver verify the email with the identity provider, then sign in to the Wallet again. |
What’s next
Section titled “What’s next”Author every rule type — quota, time window, content rules, and approvals.
PoliciesApproval is one policy type among several.
WalletWhere approvers see and act on requests.
Outbound webhooksBe told when a request is held, decided, expires or executes.
Approve an agent's work from SlackOne agent per account, one per job, one Slack message per run, one reaction to decide it.
ErrorsThe full approval error hierarchy.
Resume after a process restart
Section titled “Resume after a process restart”Persist the pending call’s approvalId (TypeScript) or approval_id (Python)
in your durable job record. After restarting, construct a fresh provider client:
const resumed = await provider.resume(savedApprovalId);const result = await resumed.wait();const body = result.bodyJson();resumed = await provider.resume(saved_approval_id)result = await resumed.wait()body = result.body_json()The backend supplies the stored provider, operation and immutable contract version.
The provider package verifies provider/version and applies that operation’s validator
and fault handling. Mismatches raise ManagedOperationError with
managed_approval_contract_mismatch or managed_approval_operation_mismatch.
The ID yields a union of operation outputs; TypeScript callers can narrow the call
by resumed.operation. No operation or version is accepted from the caller.
Generic app.integrations.resume(id) preserves raw response access and exact-number
decoding; use the provider package for its response validator. Both use the existing
approval poll’s proxy:execute or approvals:read permissions and app/agent isolation.
Resume also works after execution while the result is retained. Denial, expiry,
execution failure and result purging retain the existing approval errors. Resume
never resubmits the request. Raw approvals or missing stored identities fail with
managed_approval_identity_unavailable.