Approval

Asks a person to allow an action before an agent takes it.

Refund order #4471 to the customer's card

Scout wants topayments.refund
Customer
Grace Hopper
Amount
$129.00
Reason
Arrived damaged. Photo attached to the ticket.
Expires in 30 minutes

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/approval

Usage

import type { ApprovalState } from "./ui/uicontext/components/kit/Approval.ts"import { Approval } from "./ui/uicontext/components/kit/Approval.ts"
const Message = UiSchema.TaggedEnum({ AnsweredApproval: { choice: Schema.String } })export const DeployApproval = (h: Html.H<typeof Message.Type>, state: typeof ApprovalState.Type) =>	Approval(h, {		props: {			id: "deploy-218",			title: "Deploy build 218 to production",			fields: [{ label: "Service", value: "billing-api" }],			digest: "deploy:billing-api:218",			actor: { id: "scout", name: "Scout", kind: "agent" },			choices: [				{ id: "deny", label: "Deny", dismiss: true },				{ id: "allow", label: "Deploy", primary: true },			],			can: ["answer"],			// your app keeps the state: Pending, then Answered once it records the choice			state,		},		onEmit: { Chose: ({ choice }) => Message.AnsweredApproval({ choice }) },	})

Examples

Answered, expired and read-only

The card after it's decided, when it timed out, when the run ended first, and for someone who may not answer.

Invite two contractors to the Design workspace

Scout wants to
Change
[email protected], [email protected]
Approved · Grace Hopper · Dec 1, 2026, 8:12 AM

Close 14 stale issues in the Mobile project

Scout wants to
Change
Issues untouched for 90 days
Expired without an answer

Rotate the webhook signing secret

Scout wants to
Change
Webhook: invoices.paid
Stopped: the run was cancelled

Raise the monthly model budget to $400

Scout wants to
Change
From $250 to $400
Only workspace owners can answer this.

API reference

Props

Approval props
NameTypeDefaultDescription
idrequiredstring—Identifies the request, for agents and for the outcome
titlerequiredstring—What will happen, as a sentence: "Send this email to [email protected]"
fieldsrequiredApprovalField[]—The exact action: where, to whom, with what content
digestrequiredstring—Identifies this exact action (operation, target, payload); an answer applies only to it
actorrequiredActor—Who asked: the agent (or person) that wants to take the action
toolstring—The tool it would call, shown small under the title: "issues.update"
choicesrequiredApprovalChoice[]—The answers to offer, such as Allow once and Deny; one may be primary
canrequiredCan(["answer"])—"answer" when this person may answer; without it, whoMayAnswer says who can
whoMayAnswerstring—Shown to people who can't answer: "Only workspace admins can approve this."
expiresstring—Already formatted: "Expires in 30 minutes"
staterequiredApprovalState—Whether the request is pending, answered (with the choice and who made it), expired or retired
macbooleantrue⌘ on a Mac, Ctrl elsewhere, for the keycaps; true by default
localestring—Formats the answer's ISO time; the reader's own when left out
timeZonestring—The time zone for the answer's time; the reader's own when left out
outcomeOutcome | null—The app's answer to Chose, by this approval's id. Pending holds the buttons while the answer travels; Refused shows the reason and lets the person answer again. Accepted needs nothing: pass the new state.

Events

Approval events
EventPayloadDescription
Chose{ choice: string }The person picked one of choices, by its id

Agent actions

What agents can do with Approval
ActionDescription
ClickedChoiceasks firstAnswer the approval with one of its choices (see page_query)

Accessibility

  • The exact action shows before the choices, so the person reads what they're allowing.
  • An answer applies only to the action named by digest: an agent can't answer a different action than the one it read.
  • After an answer the card says who answered and when, and its buttons go away.

Source