RiskboundDocs

Onboarding guide

5. Approvals

EnterpriseSome features on this page are in the Enterprise edition.

When your policy answers ask_human, the action waits for a person. This page is for the lead who decides who those people are.

How an approval works#

  1. The agent asks to act. Policy says ask_human.
  2. Riskbound opens an approval. It is shown in the dashboard and, if you turn it on, posted to Slack.
  3. A person approves or rejects it, with an optional note.
  4. On approve, the agent's action runs. On reject, it does not run, and the agent's code gets the reason approval_rejected.
  5. Who answered, when, how (dashboard, API or Slack) and their note are written to the evidence log.

Nobody answers? An approval expires after 15 minutes by default. Then it counts as a no: the action does not run and the reason is approval_expired. The SDK also stops waiting after its own approval timeout (15 minutes by default, page 7).

An agent key can never approve. Only admin keys can, so an agent cannot approve its own request.

In the dashboard#

Open Approvals. Each request shows the agent, the tool, the params and the rule that asked for a person. Add a note if you want, then press Approve or Reject. The page refreshes itself every 10 seconds while it is open. The Overview page shows how many are waiting.

Anyone signed in with an admin key can answer. The name they typed at sign-in is recorded. Enterprise With single sign-on, people sign in through your identity provider instead, and each approval records the person it names, not a typed name. Community has admin-key sign-in only.

With the API#

Useful for your own tools or for testing. List what is waiting:

bash
curl -s "$RISKBOUND_URL/v1/approvals" -H "Authorization: Bearer $RISKBOUND_ADMIN_KEY"
json
[{"id":"13757d46-...","decisionId":"7c1ac736-...","expiresAt":"...","agent":"support-bot","tool":"refund","params":{"currency":"USD","order_id":"ord_1003","amount_minor":48000},"reasons":["refund-needs-approval"]}]

Answer one. Use "approve": false to reject:

bash
curl -s -X POST "$RISKBOUND_URL/v1/approvals/<approval id>/resolve" \
  -H "Authorization: Bearer $RISKBOUND_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"approve": true, "resolved_by": "Your name", "note": "Customer was double charged"}'
json
{"id":"13757d46-...","status":"approved","decisionId":"7c1ac736-..."}

An approval can be answered once. A second answer, or an answer after it expired, is refused.

In Slack#

Approval requests can be posted to a Slack channel with Approve and Deny buttons. Only the Slack users you name can press them.

Set it up#

  1. Ask us to install the Riskbound Slack app in your workspace. We run one Slack app for every partner.

  2. Invite the app to the channel where approvers should see requests, for example #refund-approvals.

  3. Collect three kinds of Slack ids. They are stable, unlike display names:

    • your workspace id, which starts with T,
    • the channel id, which starts with C,
    • each approver's member id, which starts with U. In Slack, open the person's profile, open the menu, and choose Copy member ID.
  4. Link the workspace and channel:

    bash
    curl -s -X POST "$RISKBOUND_URL/v1/slack/settings" \
      -H "Authorization: Bearer $RISKBOUND_ADMIN_KEY" \
      -H "Content-Type: application/json" \
      -d '{"team_id": "T0123ABCD", "channel_id": "C0123ABCD", "actor": "Your name"}'
  5. Add each approver, with the name the evidence log should record:

    bash
    curl -s -X POST "$RISKBOUND_URL/v1/slack/approvers" \
      -H "Authorization: Bearer $RISKBOUND_ADMIN_KEY" \
      -H "Content-Type: application/json" \
      -d '{"slack_user_id": "U0123ABCD", "approver": "Finance on call", "actor": "Your name"}'
  6. Check it:

    bash
    curl -s "$RISKBOUND_URL/v1/slack" -H "Authorization: Bearer $RISKBOUND_ADMIN_KEY"
    json
    {"enabled":true,"settings":{"teamId":"T0123ABCD","channelId":"C0123ABCD","updatedAt":"..."},"approvers":[{"slackUserId":"U0123ABCD","approver":"Finance on call","createdAt":"..."}]}

    enabled is true when Slack is switched on for our server. If it is false, tell us.

To remove an approver:

bash
curl -s -X POST "$RISKBOUND_URL/v1/slack/approvers/U0123ABCD/remove" \
  -H "Authorization: Bearer $RISKBOUND_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"actor": "Your name"}'

Every change to these settings is written to the evidence log, with the actor you give. Slack setup is through the API for now. Coming soon: a Slack settings page in the dashboard.

What happens in Slack#

  • A request is posted with the agent, the tool, the params and the rule.
  • A listed approver presses Approve or Deny. The message changes to say who answered, so nobody can press again.
  • Anyone else who presses is told, privately, that they are not an approver. Nothing changes.
  • The evidence log records the approver's name, that it came from Slack, and their Slack user id.

Limits to know#

  • Answering in the dashboard does not update the Slack message. If someone then presses a button in Slack, they are told it was already answered.
  • If Slack is down, the request is not lost. It still waits in the dashboard. A failed Slack post is not retried.
  • Params are shown in the Slack message. Keep personal data out of params (page 2).
  • Anyone who takes over an approver's Slack account can approve. Keep the approver list short, and remove people when they change roles.

Next: 6. Evidence.