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

Tool Call

Tool call with approval. Pro · AI chat and agents › Agents and reasoning

One tool invocation by a model: arguments, live status, result or error, and an optional approval step.

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add tool-call
npm install valyro-ui-pro

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

Props

PropTypeDefault
name *stringTool identifier as the model calls it, e.g. search_docs.
titleReactNodeHuman-readable title. Defaults to name.
iconReactNodeReplaces the wrench icon.
status *'awaiting-approval' | 'running' | 'success' | 'error' | 'denied'Lifecycle stage: sets the status icon and label, the live timer, the error and the approval step.
argsunknownArguments the model passed (JSON-serialisable); shown as formatted JSON.
resultunknownTool output: strings show as text, anything else as formatted JSON.
renderResult(result: unknown) => ReactNodeCustom result view, e.g. a weather card or a table.
errorReactNodeWhat went wrong, shown while status is error.
onRetry() => voidAdds Retry to the error.
startedAtDateInputStart time; a running call counts up from it.
durationnumberRun time in milliseconds, shown once the call has finished.
onApprove(approval: ToolCallApproval) => voidHuman-in-the-loop: shown with Deny while status is awaiting-approval.
onDeny() => voidAdds a Deny button to the approval step while status is awaiting-approval.
approvalPromptReactNodeReplaces the default approval prompt.
variant'card' | 'inline''card'inline is a compact row for chat transcripts. Default card.
openbooleanArguments and result are shown. Default: open while awaiting approval.
defaultOpenbooleanInitial open when uncontrolled.
onOpenChange(open: boolean) => voidCalled with the new open when it changes.
localestringBCP 47 locale for timings; defaults to the ThemeProvider's.
labelsPartial<ToolCallLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: Chain of Thought · Next: Agent Plan · All AI chat and agents