Skip to content

Refuse an approval

Refuse one Approval you name, with your reason: the Action it holds ends refused and nothing it would do runs.

Name the Approval you mean, and your agent reads it back before it records your no and your reason. The Action it holds ends refused, the agent that asked reads why, and to say yes instead you answer an approval.

What you get

  • 1the Approval you named, read back to you before anything is answeredApproval
  • 1refusal recorded with your reason, so the agent reads whyApproval
  • 1held Action ended `refused`: nothing it would have done runsAction

Your agent does

Approval.get then Approval.refuse
You, to your agent

Refuse that request and tell the agent why.

No to the $740 ad spend.

Turn down the pending request.

# 1. Approval.get
RUN=$(uuidgen)  # once per request; reuse it only to retry this request
curl https://api.sb/leaseline.app/approvals/approval_o2PM4EUAdC \
  -H "Authorization: Bearer $SB_TOKEN"

# 2. Approval.refuse
curl -X POST https://api.sb/leaseline.app/approvals/approval_o2PM4EUAdC/refuse \
  -H "Authorization: Bearer $SB_TOKEN" \
  -H "Idempotency-Key: refuse-an-approval-leaseline.app-$RUN-2" \
  -H "Content-Type: application/json" \
  -d '{"reason":"The March budget is spent."}'
RUN=$(uuidgen)  # once per request; reuse it only to retry this request
npx startup-builder do Approval.get --data '{"id":"approval_o2PM4EUAdC"}'
npx startup-builder do Approval.refuse --data '{"approval":"approval_o2PM4EUAdC","reason":"The March budget is spent."}' --idempotency-key refuse-an-approval-leaseline.app-$RUN-2
{
  "name": "do",
  "arguments": {
    "code": "await $.Approval.get({ id: 'approval_o2PM4EUAdC' })\nreturn await $.Approval.refuse({ approval: 'approval_o2PM4EUAdC', reason: 'The March budget is spent.' })",
    "idempotencyKey": "refuse-an-approval-leaseline.app-<run>"
  }
}
import { $ } from 'startup-builder'

const run = crypto.randomUUID() // once per request; reuse it only to retry this request
await $.Approval.get({ id: 'approval_o2PM4EUAdC' })
await $.Approval.refuse({ approval: 'approval_o2PM4EUAdC', reason: 'The March budget is spent.' }, { idempotencyKey: `refuse-an-approval-leaseline.app-${run}-2` })

Change it

  • Tell the agent to try again next month.
  • Refuse every ad spend over $500 this month.
  • Show me what is still waiting.

Under the hood

Systems
Work queue
Nouns
Approval, Action
Events
Approval.refused