Tool Approval

A human-in-the-loop permission card for reviewing tool details, allowing once, remembering access, or denying execution.

Preview

Allow this tool to run?
terminal.run
Approval required

The agent wants to run the project test suite in the current workspace.

Command
bun test tests/a11y.test.tsx
Directory
ui-components

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/tool-approval

API Reference

ToolApprovalCode

code
string
language?
"text" | "bash" | "diff" | "json" | "tsx" | "typescript"
bash
className?
string

ToolApproval

tool
ReactNode
title?
ReactNode
Allow this tool to run?
description?
ReactNode
parameters?
ToolApprovalParameter[]
[]
status?
"complete" | "error" | "pending" | "approved" | "approving" | "denied" | "running"
pending
open?
boolean
defaultOpen?
boolean
false
onOpenChange?
((open: boolean) => void)
onApprove?
(() => void)
onAlwaysAllow?
(() => void)
onDeny?
(() => void)
className?
string

Composition

Place executable source inside the approval request when the decision depends on reviewing it.

Message
└── MessageContent
    └── ToolApproval
        └── ToolApprovalCode

Note: Approval Card handles broader questions and review decisions. Agent Activity shows the pending and resumed execution context. Tool Result displays the outcome after an approved tool runs.

How it works

Tool approval is a permission boundary. The person must understand what will run, what access it needs, and whether their choice applies once or changes future behavior.

Updated