Tool Approval

Asks a person before an agent runs a tool: it lists the call's parameters, can show the code or command to be executed, lets them approve a single run, grant standing access or deny, then follows the call through running, complete or error.

Preview

Tool Approval preview width

Install

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

$ bunx --bun shadcn add @karaui/tool-approval
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

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?
"error" | "complete" | "pending" | "approved" | "running" | "approving" | "denied"
pending
open?
boolean
—
defaultOpen?
boolean
false
onOpenChange?
((open: boolean) => void)
—
onApprove?
(() => void)
—
onAlwaysAllow?
(() => void)
—
onDeny?
(() => void)
—
className?
string
—

Composition

When the choice depends on reading the code, show that code within the request itself.

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

Note: Approval Card takes on open questions and wider reviews. Agent Activity shows the run that is waiting and what resumes. Tool Result shows what the tool returned once it ran.

How it works

Approving a tool draws a line around what the agent may do. People need to see what will execute, what it can touch, and whether saying yes covers this call only or every call after it.

Updated