Agent Approval Gate
Подтверждение действия агента: риск, diff, явное согласие и журнал решений. Pro · ИИ: чат и агенты › Агенты и рассуждения
Установка
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';
Пропсы
| Prop | Type | Default | |
|---|---|---|---|
action | AgentApprovalAction | null | The 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. | |
riskFactors | ReactNode[] | Concrete reasons it is risky: "Deletes data", "Sends an email to 1,200 people". | |
diff | AgentApprovalDiff | AgentApprovalDiff[] | What changes: one text or several files, shown as a unified diff. | |
onApprove | (input: AgentApprovalDecisionInput) => unknown | Called by Approve. Return a promise to show progress until it settles; a rejection keeps the gate open with an error. | |
onReject | (input: AgentApprovalDecisionInput) => unknown | Called by Reject; same promise handling as onApprove. | |
pending | boolean | false | The decision is being sent (when you track it yourself): buttons are disabled with a spinner. |
decision | AgentApprovalOutcome | null | Decision taken. null: still waiting. | |
defaultDecision | AgentApprovalOutcome | null | null | Initial decision when uncontrolled. |
onDecisionChange | (decision: AgentApprovalOutcome | null) => void | Called 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. | |
confirmText | string | Text 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. |
log | AgentApprovalLogEntry[] | History of the request: asked, decided, expired. | |
redactSecrets | boolean | true | Masks secrets in action.params. Default true. |
loading | boolean | false | The action is loading: skeleton. |
error | ReactNode | Something went wrong (loading or saving); shown as an alert. | |
title | ReactNode | Heading. Default: labels.title. | |
headingLevel | 2 | 3 | 4 | 5 | 3 | Level of the heading (default 3). |
timeZone | string | IANA time zone of the log times (default: the ThemeProvider's, then the reader's). | |
locale | string | BCP 47 locale for dates; defaults to the ThemeProvider's. | |
labels | Partial<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. |
Похожие компоненты
- Chain of Thought — Ход рассуждений модели
- Tool Call — Вызов инструмента с подтверждением
- Agent Plan — Живой план задач агента
- Agent Trace Timeline — Шаги агента на водопаде: время, токены, стоимость, вход и выход без секретов
- Memory Panel — Что помнит ассистент
- AI Chat Window — Окно AI-чата
- Chat Message — Сообщения с потоковым выводом
- Message Branches — Версии сообщения и дерево веток диалога
- Streaming Text — Плавный вывод потока токенов
- Markdown Preview — Отображение Markdown
- Response Feedback — Оценка ответа и рубрика для асессоров
- Prompt Composer — Поле промпта с вложениями
Назад: Agent Trace Timeline · Далее: Memory Panel · Весь раздел «ИИ: чат и агенты»