ApprovalGate

An agent asks before it runs a tool. Review the input, edit it, approve once or always, or deny; the card settles into its decision. AI.

Open playground
send_emailWants to run thisHard to undo
{
  "to": "mara@northfield.co",
  "subject": "Invoice 2041 is overdue",
  "cc": []
}

About

ApprovalGate is a React component in the AI category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { ApprovalGate } from "@ashutoshswamy/smoui" and set name, input, risk among its 5 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { ApprovalGate } from "@ashutoshswamy/smoui";

<ApprovalGate name="send_email" risk="high" input={{ to: "mara@northfield.co" }} onApprove={(input, always) => run(input)} />

Props 5

name

The tool the agent wants to run.

string
input

Arguments. Objects print as JSON and can be edited.

unknown
risk

Sets the risk label and its colour.

"low""medium""high"
onApprove

Gets the edited input and the always-allow choice.

(input, always) => void
onDeny

Called when denied.

() => void