affectUI › Components › Agents
Latency Range
How fast an agent answers, hour by hour, like a blood-pressure chart – every hour as a bar from p50 to p95, pink above the target, the latest large and in blue.
Part of affectUI Pro. Install: npx shadcn@latest add https://www.affectui.com/r/latency-range.json · Import from @/components/ui/latency-range
When to use
- How fast an agent answers over the day – the typical time and the slow tail – and whether it stays under a target
- A dashboard tile next to other agent tiles, live as new hours come in
When not to use
- Where the time of one run goes, step by step – use Trace Waterfall
- How long each agent takes for its part – use Agent Timing
Usage
import { LatencyRange, type LatencyPoint } from "@/components/ui/latency-range";
const points: LatencyPoint[] = hours.map((h) => ({
label: h.hour, // "14"
p50: h.p50Ms,
p95: h.p95Ms,
runs: h.runs,
}));
<LatencyRange title="Support agent latency" points={points} target={2500} onAction={() => openMetrics()} />Props
| Name | Type | Default | Description |
|---|---|---|---|
points | LatencyPoint[] | { label, p50, p95, runs? } – oldest first, the last one is now; labels must be unique, they keep the bars in place as new hours come in | |
target | number | The p95 to stay under, in ms – a pink line; the part of a bar above it runs from pink to orange | |
title | string | "Latency Range" | Heading on the frame |
icon | ReactNode | A small mark before the title – defaults to a pulse, in pink | |
actionLabel / onAction | string / () => void | "Open" | The button on the top right – it shows when onAction is given |
formatMs | (ms: number) => string | "840ms" / "2.4s" | Formats every time |
className | string | Extra class on the root |
Keyboard
- Tab: Moves into the chart (one stop) and on to Open
- ArrowLeft / ArrowRight: Walks the hours and shows each one's numbers; Home and End jump to the oldest and now
- Esc: Lets go of the hour
Accessibility
- The chart is a single tab stop; the hour you're on is its description, with p50, p95 and runs
- Above the target is said in words, not only in pink
Responsive
- Built on a container query; under 400px the two columns get tighter – the card keeps the same size as every agent chart card
- The oldest hours fade out at the left edge
- Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"
Requirements
- React 19
Related
- Run Transit – An agent carrying a job from one place to another like a flight on its way – where it comes from, where it goes, the time left and a bar its pixel mark rides on
- Agent Timing – An agent run as a timing diagram – a signal line per agent that steps up when it thinks or calls a tool, with hand-offs drawn straight between rows
- Trace Waterfall – Where the time and money of an agent run go – every LLM call, tool call and sub-agent as a bar on a live timeline, with cost per step and the slowest call marked
- KPI Chart – Metric card with a multi-line chart and a tooltip that follows the pointer