suiss/ui · AI
Chain of Thought
A summary line that expands into the steps an agent took, such as reads, searches and tool calls.
Chain of Thought is a summary line that expands into the steps an agent took. The summary says what happened, such as "Researched in 3 steps", and each step inside it is a line of its own that can expand into its output.
It is built with Trace: a TraceCollapsible for the summary and a nested Trace for the steps. For a single tool call, see Tool. For steps that are known up front, see Plan.
Installation
Chain of Thought is built with Trace, Code Block and Badge.
Or use the suiss/ui CLI:
Usage
Set keepMounted on the summary's TraceCollapsibleContent so the steps keep their open state while the summary is closed.
Use defaultExpanded instead of defaultOpen on TraceCollapsible.
Steps
Each step is a TraceLine, or a TraceCollapsible when it has output to show. Set its status and write the title in the matching tense.
| Step | status | Title |
|---|---|---|
| Running | "running" | Searching for … |
| Done | none | Searched for … |
| Failed | "error" | Failed to search for … |
Set the summary's status and title from its steps: running while any step runs, error when one failed, and a count such as "Researched in 3 steps, 1 failed" once they are done.
Search results
When a step runs a web search, show each result as a link row, or show the hostnames as a Badge each:
AI SDK
Render each tool part as a step. The summary is running while tool parts stream and before the reply text starts. It opens while the steps run and keeps the reader's choice once they open or close it.
StepLine renders one tool part as a line, as in Tool.
API Reference
See Trace, Code Block and Badge.
Accessibility
- The summary and each expandable step are buttons with
aria-expanded. - Say the state in each title, such as "Searching" or "Failed to search", since status is otherwise shown with color and motion.
- Add "(opens in a new tab)" with
sr-onlyto links that open a new tab.