Docs · Control

Approvals

Hold chosen tool calls until a person approves them, and see what the agent gets while it waits.

Docs menu
On this page
  1. What an approval is
  2. Which calls are held
  3. Approval policies
  4. Who approves
  5. Step-up and initiator confirmation
  6. What the agent sees
  7. Timeouts
  8. Approval webhook
  9. Tool reviews
  10. See also

What an approval is#

Policy answers "may this agent call this tool?" with allow or deny. An approval adds a third answer: only if a person says yes, for this specific call.

When a call that policy allows also matches an approval rule, bastn does not send it to the tool. It parks the call as a hold and waits for a decision. The call runs only after a team admin approves it, and exactly as approved.

Which calls are held#

A call is held when any of these applies:

  • An approval policy matches it. See Approval policies.
  • It calls a destructive tool. By default every destructive call waits for an approval. See Tool effects.
  • It is a raw command call. A command tool that hands the agent the whole command line is always held, whatever the other settings. See Commands and scripts.
  • **A run budget in hold mode is exceeded.** See Run budgets.

Other controls set to hold can hold a call too, such as toxic-combination rules and an agent's risk profile.

Approval policies#

Approval policies are on the Policies page, in the Advanced group of the navigation, under Approval rules. Org admins create and change them with New approval policy; other users can read them.

A policy holds a call when every part of it that is set matches. The form leads with the first three and the team, and says in a sentence what the rule holds. The agent, the argument pattern and the condition are under Advanced.

FieldMatches
Toola glob on the tool name, for example deploy_* or * (required)
Serverone server, or any server
Hold when the tool cantools of at least this effect: do anything holds every matching call, write holds tools that write or destroy, destroy holds destructive tools
Team and Agentone team, or one agent of a team
Argument patterna regular expression matched against every string value in the arguments, such as (?i)drop\s+table
Conditionan expression over the call that must be true, such as args.amount > 200

Conditions use CEL. They can read the call's args, tool, server and agent, and facts such as the agent's risk tier.

A policy can be disabled; matching calls then pass through without a hold.

Who approves#

Holds are on Approvals, under Tool calls. Home also lists the three oldest under Needs you, each with a Review link. A hold leads with the tool and server, who made the call, why it was held and the arguments. Details shows the rest, such as whether the caller is still waiting.

  • Team admins of the hold's team approve or reject it. Org admins of that org can too.
  • Four eyes. By default you cannot approve a call you made yourself, directly or through a key of the agent that made it. You can still reject it.
  • Notes. Reject opens a note; a second Reject sends it. Add a note adds one to an approval.
  • Approve with edits. With Edit arguments, an approver can change the arguments before approving. The call then runs with the edited arguments, and the audit log keeps a digest of both what was asked and what ran.

Every decision is recorded in the audit log with the person who made it. The last 10 resolved holds are in a closed Resolved list under the pending ones, with a link to all decisions in Activity.

Step-up and initiator confirmation#

An approval policy can ask more of the people who decide its holds:

  • Step-up. Approving or confirming the hold needs a dashboard password entered recently, within 5 minutes by default. An older sign-in is asked for the password again on the card. Rejecting never needs it. Both settings are under Advanced in the policy form, as Step-up and Approved by.
  • Initiator confirmation. The user who made the call confirms it first, under Needs your confirmation in Approvals, or declines it. Then a team admin approves it, as for any hold, without edits to the arguments. The confirmation does not count as the approval, so the four-eyes rule still applies.

What the agent sees#

An HTTP request cannot wait for hours, so a hold works in two steps.

  1. A short wait. The call waits for a decision, about a minute by default. If someone approves in time, the call runs and the agent never notices. If someone rejects it, the agent gets an error with the decision and reason.
  2. Retry. If nobody has decided when the wait ends, the agent gets JSON-RPC error -32001, approval required, with the approval id and when the hold expires. When the agent retries the identical call, it attaches to the same hold and waits again. A client can also send the header X-Bastn-Approval: <id>.
json
{"error": {"code": -32001,
  "message": "approval required: call is held for human approval (approval id 42). Retry with header X-Bastn-Approval: 42 once approved; the hold expires at …",
  "data": {"approval_id": 42, "status": "pending", "expires_at": "…"}}}

An approval works for one call, once. The retry must match the held call exactly: same server, tool, arguments and caller. An approval can never authorize a different call or a different caller.

Timeouts#

By default:

  • a pending hold expires after 1 hour;
  • an approved hold must be retried within 1 hour of the approval, or it expires unused.

A rejected or expired hold answers the retry with JSON-RPC error -32002, naming the decision. A retry after an agent was paused or killed is refused.

Stopping the caller also rejects its pending holds at once. Pausing, killing or retiring an agent, or suspending the member who made the call, rejects them as decided by kill switch, with the reason, and records each rejection in the audit log. See Stop an agent.

Approval webhook#

An org can send each new hold to a webhook, for example to post it in a chat channel. Org admins set it under Settings, Organization, Approval webhook.

  • The URL must be https. Redirects are not followed.
  • Creating the webhook shows a signing secret once. Every delivery carries an X-Bastn-Signature header with a timestamp and an HMAC-SHA256 of the body; verify it before you trust a delivery. You can rotate the secret, pause deliveries, and send a test.
  • Delivery is retried a few times and never blocks the held call. The card shows the last delivery.
  • Only your org's holds go to your org's webhook.

The body includes the held call's arguments, so point it at a channel whose readers may see them. Values a server is set to redact are redacted in the body.

The body's approval_url only opens the hold in the dashboard. It carries no credential and decides nothing: deciding still needs a team admin of the hold's team, with the four-eyes check.

Tool reviews#

Approvals also lists tools, not only calls. A server with New tools or When a tool changes set to hold keeps a new or changed tool away from agents and queues it under Approvals, Tool reviews (in the More menu of the tabs). Approve and pin it, or reject it. See Review held tools.

See also#

Something missing or wrong on this page? Write to support@bastn.ai.