suiss/ui · AI
Tool
A tool call the agent makes, from input to output, including errors, approvals and output in a sheet.
Tool is a tool call the agent makes, such as running a command or reading a file. The line follows the call from input to output, including errors and calls that wait for approval.
It is built with Trace: a plain TraceLine while the call runs, and a TraceCollapsible with a Code Block once its output arrives. For several calls under one summary, see Chain of Thought.
Installation
Tool is built with Trace and Code Block. The approval prompt uses Item and Button, and long output can open in a Sheet.
Or use the suiss/ui CLI:
Usage
Examples
States
A finished call, a failed call, a denied call and a running call.
Map each tool call's state to a status and a title:
| Tool call | status | Title |
|---|---|---|
| Input streaming or ready, while the chat streams | "running" | Running … |
| Input streaming or ready, after the chat stops | "error" | Failed to run … |
| Waiting for approval | — | Not a line. An Item outside Trace with Approve and Deny buttons. |
| Approved and running | "running" | Running … |
| Output available | none | Ran … |
| Output error | "error" | Failed to run … |
| Denied | none | Denied … |
Output in a sheet
For long output, wrap the TraceLine in a SheetTrigger and show the output in the sheet.
Approval
A pending approval is a question for the person, not a step the agent took, so it sits outside Trace as an Item. Once the person answers, the call goes back to being a line. See Confirmation.
AI SDK
Render each tool part as a line. A call is a plain TraceLine while it runs, and a TraceCollapsible once its output arrives.
For approvals, render the approval-requested state as an Item and answer it with addToolApprovalResponse:
Pass sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithApprovalResponses to useChat so the chat continues once every approval has an answer. A tool that runs on the client stays input-available after the chat stops until you call addToolOutput; treat it as waiting, not failed.
API Reference
See Trace, Code Block, Item and Sheet.
Accessibility
- A call with output is a button with
aria-expanded; a call in a sheet takes the sheet trigger's focus and Escape behavior. - Write the state into the title, such as "Failed to run pnpm dev", so it does not rely on color.
- The approval buttons are regular buttons with visible labels, and they are not inside the
Tracerow.
Tool on mobile is built from the same parts as on the web: Trace, Code Block, Message, Bubble. The example above is a static demo; connect it to your agent by rendering the same parts from your messages.
Installation
API Reference
See Trace, Code Block, Message, Bubble.