ValyroUI Русская версия

Agent Approval Gate

Agent action approval: risk, diff, explicit consent and a decision log. Pro · AI chat and agents › Agents and reasoning

A stop sign for an AI agent's risky action: what it wants to do and why, how risky it is, the exact changes, and Approve / Reject with an explicit confirmation. Nothing is approved without a person pressing Approve; the decision and its comment go to a log.

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add agent-approval-gate
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { AgentApprovalGate } from 'valyro-ui-pro';

Props

PropTypeDefault
actionAgentApprovalAction | nullThe action waiting for a decision; null shows the empty state. Give the gate a new key per action so the confirmation starts over.
riskLevel *'low' | 'medium' | 'high' | 'critical'How dangerous the action is; sets the colour, the button and the default confirmation.
riskFactorsReactNode[]Concrete reasons it is risky: "Deletes data", "Sends an email to 1,200 people".
diffAgentApprovalDiff | AgentApprovalDiff[]What changes: one text or several files, shown as a unified diff.
onApprove(input: AgentApprovalDecisionInput) => unknownCalled by Approve. Return a promise to show progress until it settles; a rejection keeps the gate open with an error.
onReject(input: AgentApprovalDecisionInput) => unknownCalled by Reject; same promise handling as onApprove.
pendingbooleanfalseThe decision is being sent (when you track it yourself): buttons are disabled with a spinner.
decisionAgentApprovalOutcome | nullDecision taken. null: still waiting.
defaultDecisionAgentApprovalOutcome | nullnullInitial decision when uncontrolled.
onDecisionChange(decision: AgentApprovalOutcome | null) => voidCalled once a decision went through (after the promise of onApprove / onReject resolved).
confirmation'none' | 'checkbox' | 'type'Step before Approve: none, a checkbox, or type the confirm text. Default by risk: none up to medium, checkbox for high, typing for critical.
confirmTextstringText to type for confirmation: 'type'. Default: the action's target.
commentRequired'never' | 'reject' | 'always''never'When a comment is required: never (default), reject or always.
logAgentApprovalLogEntry[]History of the request: asked, decided, expired.
redactSecretsbooleantrueMasks secrets in action.params. Default true.
loadingbooleanfalseThe action is loading: skeleton.
errorReactNodeSomething went wrong (loading or saving); shown as an alert.
titleReactNodeHeading. Default: labels.title.
headingLevel2 | 3 | 4 | 53Level of the heading (default 3).
timeZonestringIANA time zone of the log times (default: the ThemeProvider's, then the reader's).
localestringBCP 47 locale for dates; defaults to the ThemeProvider's.
labelsPartial<Omit<AgentApprovalGateLabels, 'riskLevels' | 'outcomes'>> & { riskLevels?: Partial<Record<AgentRiskLevel, string>>; outcomes?: Partial<Record<AgentApprovalLogEntry['outcome'], string>>; }Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: Agent Trace Timeline · Next: Memory Panel · All AI chat and agents