Human approvals
Review held requests in the dashboard or CLI and redeem an exact request once.
Human approvals are implemented in the API, dashboard and CLI. Requests are reviewed in the dashboard or CLI. The API calls this delivery type dashboard.
To notify people in Slack, email or anywhere else, subscribe a webhook to approval.requested and
forward the event from your backend.
SDK availability: the published TypeScript 0.3.0 workflow uses authorize, enforce, approval reads and webhook
verification. SDK 0.4.0 is implemented in this checkout and has not been published. The protect, execute,
resume and approvals.wait examples below require that local version. They do not imply that a registry install
or hosted deployment already includes the new helpers.
Lifecycle
- Your trusted server calls
POST /v1/authorizewith its project API key. - A matching
require_approvalrule returnsapproval_requiredandapproval.id/expires_at. Keep the action stopped and store the original request and exact tool arguments on your trusted server. - A permitted person opens Workspace → Approvals, or uses the CLI, to approve or reject the pending request.
- An
approval.approvedwebhook notifies your backend, or your backend observes approval through polling. Verify the webhook signature and retrieve current approval state. - Redeem the identical original request plus
approval_idagainst current policy. Execute only after an allowed redemption. Approving or receiving a webhook does not execute the action.
In the updated dashboard, Policies → Test a decision can preview an approval rule before publishing. It shows Needs approval without creating a real approval. Preview does not verify delegation IDs or redeem approval IDs; use runtime requests to test the complete lifecycle.
Protect and resume a tool with checkout SDK 0.4.0
From the repository root, build and pack the unpublished SDK:
npm run build --workspace=@reqlo/sdk
npm pack --workspace=@reqlo/sdk --pack-destination /tmpIn your application's directory:
npm install /tmp/reqlo-sdk-0.4.0.tgzRun the updated API locally with your project's configuration. The example defaults to port 8080; adjust
REQLO_API_URL if yours differs, or use a hosted API after deploying the changes.
For this example, register a starter_order resource type with no attributes and a starter.refunds.create action.
Its context schema needs a required integer amount_cents, minimum 1, with server provenance. Publish a policy scoped
to your agent that allows amounts up to 5000 and requires approval above 5000. With no channel specified, owners and
admins can review. Other published denies still take precedence.
import { Reqlo } from "@reqlo/sdk";
const reqlo = new Reqlo({
apiKey: process.env.REQLO_API_KEY!,
baseUrl: process.env.REQLO_API_URL ?? "http://127.0.0.1:8080/v1",
});
const refund = reqlo.protect({
request: (args: { orderId: string; amountCents: number }) => ({
agent: { id: "<YOUR_AGENT_ID>" },
subject: { id: "customer_demo", kind: "user" },
action: "starter.refunds.create",
resource: { type: "starter_order", id: args.orderId },
context: { amount_cents: args.amountCents },
}),
execute: async (args) => ({ simulated: true, ...args }),
});
const args = { orderId: "order_demo", amountCents: 7500 };
const result = await refund.run(args);
if (result.status === "pending") {
// Save args, result.request and result.decision.approval.id in a durable server-owned job.
console.log("Waiting for approval", result.decision.approval.id);
} else if (result.status === "denied") {
console.log("Stopped", result.decision.reason_code);
} else {
console.log(result.value); // The callback ran only after allow.
}The callback above simulates a refund. In a real application, derive the subject from a verified session and load
authoritative order and amount data on your server. Keep the protected operation identical to the policy request.
protect snapshots JSON arguments, derives the request from a separate copy, and binds the complete argument digest.
After a verified approval notification, retrieve the current approval and claim the saved job atomically. Then resume using the original saved arguments, not arguments supplied by the webhook, browser or model:
// In the same backend, after verifying the notification and claiming your saved job:
const approvalId = "<APPROVAL_ID_FROM_SAVED_JOB>";
const savedArgs = { orderId: "order_demo", amountCents: 7500 }; // Loaded from your job store.
const approval = await reqlo.approvals.retrieve(approvalId);
if (approval.status === "approved") {
const value = await refund.resume(savedArgs, approvalId);
console.log(value);
}resume re-authorizes under current policy and invokes the callback only when the response confirms
approval_redeemed. If current policy now allows the request directly without redeeming the approval, this helper
stops too; reconcile the held job before choosing a fresh execution path. Changed arguments, rejection, expiry or
consumption stop execution.
For lower-level integrations, execute(request, callback) returns executed, pending or denied; its pending
result includes a request snapshot. Include operation_digest: operationDigest(originalArgs) to bind full arguments,
then call resume(originalRequest, approvalId, callback) with those exact arguments retained on your backend. The SDK
cannot inspect an arbitrary callback to verify which external operation it performs.
For short-lived CLI observation, the local SDK also provides:
const approval = await reqlo.approvals.wait("<APPROVAL_ID_FROM_SAVED_JOB>", {
timeoutMs: 60000,
pollIntervalMs: 2000,
});
console.log(approval.status);Waiting neither redeems approval nor executes a tool; timeout or cancellation throws. Prefer signed webhooks and
durable jobs for human review rather than holding a web request open. The repository's examples/support-agent
includes a runnable simulated refund workflow and signed webhook listener. Its file-based job claims are for local
use; production applications need transactional claims across instances.
Read and resolve requests
Project keys may call GET /v1/approvals (optionally ?status=pending) and GET /v1/approvals/{id}.
Their environment comes from the key; do not send environment_id on these reads.
Signed-in users and CLI personal access tokens include environment_id on approval reads.
Resolution requires a person's credentials and membership in the request's permitted approvers:
POST /v1/approvals/{id}/approve
POST /v1/approvals/{id}/rejectThe JSON body contains environment_id and an optional note of at most 1,000 characters.
Project API keys cannot approve or reject. The service derives the approver from the verified credentials;
clients cannot supply an approver ID.
What is an approval channel?
An approval channel is a named group of people who may approve or reject a held request, scoped to one
environment. For example, “Finance reviewers” might contain two finance team members. A policy rule references
that group using approval.channel_id.
The policy decides when approval is required; the channel decides who may give it. The individual approval request records which exact action is waiting. Creating a channel does not require approval for any action until a published policy uses it.
Do I need one?
Channels are optional. If a require_approval rule omits approval.channel_id, organization owners and admins
can resolve its requests. That default is enough for a small team where owners/admins review everything.
Create a channel when a particular team should review an action: finance for payments, editors for document publishing, or operators for infrastructure changes. Several policy rules can reference the same group, so you can reuse the approver list. When a request has a channel, only listed approvers who remain company members can resolve it; an owner or admin must also be listed. Any one permitted approver resolves a pending request.
Example: document publishing
- An owner or admin creates a channel named Document reviewers and selects the people allowed to review.
- They copy its ID into a policy rule for
documents.publishand publish the policy. - When an agent’s backend asks to publish a document, that rule can return
approval_required. - One of those reviewers opens Workspace → Approvals or the CLI and approves or rejects the request.
- After approval, the backend redeems the exact request before executing it.
The following is one rule inside a policy. Replace the example channel ID with the copied ID and register
documents.publish in the same environment before publishing the policy:
{
"id": "review-document-publishing",
"effect": "require_approval",
"actions": ["documents.publish"],
"approval": {
"channel_id": "APC_0123456789abcdef",
"expires_in_seconds": 3600
}
}If a deny rule also matches, the request is denied. A channel does not override a denial.
Create and use a channel
Owners and admins can open Approvals → Channels, choose Create channel, name it and select company members using the searchable approver list. Copy the channel ID from the table into the policy rule’s Approval channel ID field, then publish the policy. Other members can inspect channels but cannot create them. Creating a channel does not grant company membership or general management permissions.
Channel creation and policy publishing check membership and environment permissions.
Where do requests appear?
Requests appear in the ReQlo dashboard and CLI. “Channel” does not mean a Slack channel or an email inbox, and creating one does not send notifications. To notify people, configure a separate webhook endpoint; a channel still controls who may approve.
Exact request binding and expiry
An approval stores a SHA-256 digest of the canonical request, excluding approval_id itself.
Keep the agent, subject, action, resource, attributes, context and optional operation_digest unchanged for
redemption. The local SDK's protect helper computes the full argument digest automatically. In the updated MCP
gateway, it also covers the gateway identity, original tool name, and all original arguments, including nested or
unregistered fields. Existing approvals created before this binding change may need to be requested again.
A mismatched request is denied with approval_mismatch.
An approval is redeemable once. Reuse returns approval_consumed; expired or rejected requests return
approval_expired or approval_rejected. Expiry is 60 seconds to 7 days, with a default of one hour.
Policy evaluation still runs on redemption, so approval alone does not override a current denial.
The updated dashboard shows non-sensitive policy context in approval details, so reviewers can inspect fields such as the amount. Fields marked sensitive are omitted from summaries. Unregistered MCP arguments are bound by their digest but are not added to the summary; retain the complete operation in your own trusted system.
Retries and execution failures
Approval consumption happens before the tool executes. The local SDK does not retry resume, direct authorize
requests carrying approval_id, or tool callbacks. A timeout can mean that approval was consumed even though your
backend did not receive the result. A callback failure can happen after a downstream service completed its action.
Reconcile those outcomes instead of automatically repeating them. Use downstream idempotency and a durable job
claim for real side effects; single-use approval does not make external execution exactly once.
Use approval webhooks or backend polling to resume work. Always retrieve current approval state and redeem the exact request before executing. See the Approvals API for every route and its credentials.
Something wrong or unclear? Report an issue with this page.