Reasoning
The agent's thinking as it streams. A line that reads "Thinking" and opens while the model thinks, then reads "Thought" and closes when it is done; the thinking itself sits inside, and the line can show how long it took.
Usage
Reasoning
import { NgTemplateOutlet } from '@angular/common';import { Component, DestroyRef, ViewEncapsulation, type WritableSignal, computed, inject, signal,} from '@angular/core';A pattern, not a component: it is built with the Trace, a Collapsible for the thinking, in a Message. The streaming here is replayed on a timer.
Anatomy
import { ScTrace, ScTraceLine, ScTraceIcon, ScTraceTitle, ScTraceCollapsible, ScTraceCollapsibleTrigger, ScTraceCollapsiblePanelContent, ScCollapsible, ScCollapsibleTrigger, ScCollapsiblePanel,} from '@semantic-components/ui';<div scTrace> <div scCollapsible scTraceCollapsible [open]="open()"> <button scCollapsibleTrigger scTraceCollapsibleTrigger> <span scTraceLine [status]="running() ? 'running' : undefined"> <span scTraceIcon>…</span> <span scTraceTitle>Thought</span> </span> </button> <div scCollapsiblePanel> <div scTraceCollapsiblePanelContent>…</div> </div> </div></div>Open state
- Until the first words arrive, it is a plain line: nothing to open before the model has written anything.
- Then it opens while the model thinks and closes when it finishes — unless the person opened or closed it: their choice wins. The Collapsible's
openis your choice, else the running state. - The streamed text goes in a live region (here
aria-live="polite"on the trace), so "Thinking" and "Thought" are announced.
Examples
How long it thought, in a description after the title: measure it on the server and send it with the message.
Duration
The build log shows install and compile finish in under a minute. Image optimization takes almost four, and it reruns on every deploy because the cache key includes the commit hash.
import { Component, ViewEncapsulation } from '@angular/core';import { ScCollapsible, ScCollapsiblePanel, ScCollapsibleTrigger, ScTrace, ScTraceCollapsible, ScTraceCollapsiblePanelContent, ScTraceCollapsibleTrigger, ScTraceDescription,Some models send several reasoning parts in one message: each one is a line in the same trace, with its own open state.
Several parts
The user wants the slowest step of the deploy. Read the deploy log first.
Image optimization takes 3m 50s and its cache never hits: the key includes the commit hash.
import { NgTemplateOutlet } from '@angular/common';import { Component, DestroyRef, ViewEncapsulation, computed, inject, input, signal,} from '@angular/core';RTL
import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation } from '@angular/core';import { ScBubble, ScBubbleContent, ScCollapsible, ScCollapsiblePanel, ScCollapsibleTrigger, ScMessage, ScMessageContent,API reference
See the Trace and the Collapsible.