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
| Prop | Type | Default | |
|---|---|---|---|
name * | string | Tool identifier as the model calls it, e.g. search_docs. | |
title | ReactNode | Human-readable title. Defaults to name. | |
icon | ReactNode | Replaces 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. | |
args | unknown | Arguments the model passed (JSON-serialisable); shown as formatted JSON. | |
result | unknown | Tool output: strings show as text, anything else as formatted JSON. | |
renderResult | (result: unknown) => ReactNode | Custom result view, e.g. a weather card or a table. | |
error | ReactNode | What went wrong, shown while status is error. | |
onRetry | () => void | Adds Retry to the error. | |
startedAt | DateInput | Start time; a running call counts up from it. | |
duration | number | Run time in milliseconds, shown once the call has finished. | |
onApprove | (approval: ToolCallApproval) => void | Human-in-the-loop: shown with Deny while status is awaiting-approval. | |
onDeny | () => void | Adds a Deny button to the approval step while status is awaiting-approval. | |
approvalPrompt | ReactNode | Replaces the default approval prompt. | |
variant | 'card' | 'inline' | 'card' | inline is a compact row for chat transcripts. Default card. |
open | boolean | Arguments and result are shown. Default: open while awaiting approval. | |
defaultOpen | boolean | Initial open when uncontrolled. | |
onOpenChange | (open: boolean) => void | Called with the new open when it changes. | |
locale | string | BCP 47 locale for timings; defaults to the ThemeProvider's. | |
labels | Partial<ToolCallLabels> | Overrides for the built-in English text; keys left out keep their defaults. |
Related components
- Chain of Thought — Model reasoning steps
- Agent Plan — Live agent task plan
- Agent Trace Timeline — Agent steps as a waterfall: time, tokens, cost, inputs and outputs with secrets redacted
- Agent Approval Gate — Agent action approval: risk, diff, explicit consent and a decision log
- Memory Panel — What the assistant remembers
- AI Chat Window — AI chat window
- Chat Message — Messages with streaming output
- Message Branches — Message versions and a conversation branch tree
- Streaming Text — Smooth token streaming
- Markdown Preview — Rendered Markdown
- Response Feedback — Answer rating and a rubric for reviewers
- Prompt Composer — Prompt field with attachments
Previous: Chain of Thought · Next: Agent Plan · All AI chat and agents