Trace
Trace shows execution step by step (an AI agent calling tools, a CI pipeline, a deployment) so people see what the system is doing and why.
Agent: schedule a team meeting
Pending
- Read the request, Pending
A 60-minute meeting this week with all 4 people.
- calendar.readparallel
- Alex and Maria's calendars, Pending
- Sam and Priya's calendars, Pending
{ "slot": "Thu 2:00–3:00 PM", "conflicts": 0 }- Send the invite, Pending
Import
Install from npm, copy the source into your project with @yugen-ui/cli or the shadcn CLI, or import directly when working in this repo.
// npm install yugen-uiimport { Trace, TraceStep, TraceLog } from "yugen-ui";Variants
Each tile is a standalone example: hover to copy, or press Code to see the source.
- pending — Waiting, Pending
- running — In progress, Running
- success — Done, Completed1.2s
- error — Failed, Failed320ms
- skipped — Skipped, Skipped
- cancelled — Cancelled, Canceled
Six statuses
The icon and token color come with a text label, so color is never the only signal. A running step starts its timer on its own.
Deploy sakura-web
Pending
- Install dependencies, Completed12.4s
- Run tests, Completed31.8s212 tests
- 4.1s
The bundle is over the 180 KB budget.
✖ dist/index.js 214.6 KB > 180 KB
- Deploy preview, Skipped
- Deploy to production, Canceled
Pipeline with an error
A failed step opens its details on its own; here the steps after it are set to skipped / cancelled.
Answer a returns question
Pending
- 812mstool3 results
{ "query": "return policy", "top_k": 3} - Write the answer, Completed2.3s1.2k tokens
Tool call with JSON
The details slot takes any content, here a JSON CodeBlock.
Usage
- Name steps with a short verb phrase that says what the system is doing (“Check calendars”, “Send invites”).
- Open the details of a failed step by default and state the cause and the fix.
- Give people actions in the header: Stop, Run again, View full log.
- Don't dump the whole raw log into description. Put it in details, collapsed by default.
- Don't nest more than 2 levels; group steps if the agent makes dozens of small calls.
- Don't turn off announceChanges when Trace is the only place that reports progress.
Props
| Prop · Type | Default | Description |
|---|---|---|
| Trace | Default: — | Run title and secondary note. |
| Trace | Default: — | Overall status; derived from the steps by default. |
| Trace | Default: — | Total duration once finished; start time for the live timer while running. |
| Trace | Default: — | Buttons in the header (Run again, Stop…). |
| Trace | Default: "outline" | Framed, or embedded in another surface. |
| Trace | Default: "medium" | 16 / 20px icons, caption1 / body1 text. |
| Trace | Default: false / true | Hides the header; announces status changes through a live region. |
| TraceStep | Default: "pending" | Step status. |
| TraceStep | Default: — | Step name (preferably a string, so it can be used in announcements) and description. |
| TraceStep | Default: — | Duration (ms) once finished; a running step records its own start time if startedAt isn't passed. |
| TraceStep | Default: — | Info badges: model, tokens, branch… |
| TraceStep | Default: — | Expandable content (TraceLog, CodeBlock…). |
| TraceStep | Default: — | Controls the disclosure; open by default when running / error. |
| TraceStep | Default: — | Nested child steps, with a connecting line. |
| TraceLog | Default: "neutral" | Monospace log block, always LTR. |
Messages
Text built into the component: labels, aria-labels, screen reader announcements.
English by default. Change it with the messages prop of YugenProvider, by the namespace below; messagesVi has the Vietnamese set. See Interface language.
messages.trace
| Key · Type | Default (English) | messagesVi |
|---|---|---|
| pendingstring Nhãn trạng thái — cùng tên với | Default (English)"Pending" | messagesVi"Đang chờ" |
| runningstring | Default (English)"Running" | messagesVi"Đang chạy" |
| successstring | Default (English)"Completed" | messagesVi"Hoàn tất" |
| errorstring | Default (English)"Failed" | messagesVi"Lỗi" |
| skippedstring | Default (English)"Skipped" | messagesVi"Bỏ qua" |
| cancelledstring | Default (English)"Canceled" | messagesVi"Đã huỷ" |
| labelstring Tên vùng khi không có title (và không truyền | Default (English)"Progress" | messagesVi"Tiến trình" |
| steps(done: number, total: number) => string Tiến độ ở phần đầu: số bước đã xong / tổng số bước. | Default (English)(done, total) => `${done}/${total} ${total === 1 ? "step" : "steps"}` | messagesVi(done, total) => `${done}/${total} bước` |
| summarystring Tên danh sách tổng kết theo trạng thái. | Default (English)"Summary by status" | messagesVi"Tổng kết theo trạng thái" |
| durationstring Chữ ẩn trước thời lượng, cho trình đọc màn hình. | Default (English)"Duration:" | messagesVi"Thời lượng:" |
| collapseAllstring | Default (English)"Collapse all" | messagesVi"Thu gọn tất cả" |
| expandAllstring | Default (English)"Expand all" | messagesVi"Mở rộng tất cả" |