Tool UI
Use this skill to move from request to working Tool UI integration quickly.
Prefer assistant-ui when the project has no existing chat UI/runtime. Treat assistant-ui as optional when the app already has a working runtime.
Step 1: Compatibility and Doctor
Read components.json in the user's project and verify:
components.jsonexists.
Step 2: Install Components
Install command from project root
Preferred (AI-assisted integration):
Use component-specific prompts from the catalog below (e.g. integrate the plan component for step-by-step task workflows with status tracking).
Alternative (direct registry):
Multiple components:
Or via shadcn:
Complete component catalog
All 25 Tool UI components with tool-agent prompts and shadcn install commands:
Progress
Input
Display
Artifacts
Confirmation
Media
Display (Geo Map)
Example installs by use case
tool-agent (recommended):
shadcn (direct):
Toolkit setup in a codebase
After installing components, wire them into assistant-ui via a Toolkit. This section covers the full setup: provider, runtime, toolkit file, and ID handling.
1. Provider and runtime
Create an assistant wrapper that provides runtime, transport, and tools:
Key points:
useChatRuntime+AssistantChatTransport: connects to your chat API.Tools({ toolkit }): forwards tool definitions and renderers to the model.sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls: auto-continues after tool calls (optional but common for tool-heavy flows).
2. Toolkit file structure
Create a single toolkit.ts (or toolkit.tsx) that exports a Toolkit object. Each key is a tool name; each value has type, description, parameters, and render.
Tool descriptions — Always include a description on every tool. Describe when to call the tool and what role it plays, not the visible content. The Tool UI component already renders the payload (options, plan, chart, etc.) to the user; a description that repeats that content is redundant. Prefer model-oriented guidance (e.g. "Present a plan for the user to follow" or "Let the user pick one option") over content echo (e.g. "Shows a list of options with labels and descriptions").
-Frontend vs backend tools
Backend tools (model returns result; no user input):
Frontend tools (model sends args; user interaction commits via addResult):
3. API route (AI SDK)
When the chat API uses the AI SDK (streamText), define backend tools with tool() from ai:
- Use
inputSchema - Backend tools use
executeon the server; the result is streamed and rendered via the toolkitrenderfunction
4. Action-centric vs compound components
Action-centric example (OptionList):
Compound example (OrderSummary with DecisionActions):
ApprovalCard uses embedded actions; wire onConfirm/onCancel directly:
Action Model
Tool UI uses two action surfaces, rendered as compound siblings outside the display component:
ToolUI.LocalActions: non-consequential side effects (export, copy, open link). Handlers must not calladdResult(...).ToolUI.DecisionActions: consequential choices that produce aDecisionResultenvelope viacreateDecisionResult(...). The commit callback callsaddResult(...).
Compound wrapper pattern for display components with actions:
Three components are action-centric exceptions — they keep embedded action props instead of sibling surfaces. All three share a unified interface:
actions: action buttons rendered by the component.onAction(actionId, state): runs after the action and receives post-action state.onBeforeAction(actionId, state): guard evaluated before an action runs.
Components using the compound pattern: CodeBlock, CodeDiff, Terminal, ProgressTracker.
Context is shared via createContext + use() (React 19). Subcomponents throw if used outside their Root.
Receipt and Choice Convention
Components with outcomes use a choice prop to render confirmed/completed state:
When choice is present, the component renders in receipt mode — read-only, no actions.
Operational Rules
- Install the smallest set of components that solves the request.
- Every tool must have a
description; write it for the model (when to call, what role) — avoid repeating content the component will render.
Notes: Frontend tools need an execute function Backend tools have the tool implementation on the server side. Backend tool don't need either Ignore the generated files After setup:
- Ensure the required package dependencies are installed so the first experience of running after the changes is magical
- Notify the user if env variables are not set that should be for a successful run of the feature that was just implemented, most likely mainly variables required by the api chat endpoint.


