Loading component…
Loading component…
One agent run as a sequence diagram – a lifeline for you, every agent and every tool, with calls solid, replies dashed and parallel or retried messages in frames.
To reuse this local React demo, copy all files from the Code tab into the same folder, then import AgentSequence from ./agent-sequence.
import { AgentSequence, type SeqMessage, type SeqParticipant } from "@/components/ui/agent-sequence";
const participants: SeqParticipant[] = [
{ id: "you", name: "You", kind: "person" },
{ id: "lead", name: "Lead", kind: "agent", model: "Claude Opus" },
{ id: "research", name: "Researcher", kind: "agent", model: "Claude Sonnet" },
{ id: "github", name: "GitHub", kind: "tool", logo: <GitHubLogo /> },
];
const messages: SeqMessage[] = [
{ id: "m1", from: "you", to: "lead", label: "Fix the checkout crash", at: 0 },
{ id: "m2", from: "lead", to: "lead", label: "Plan: find, patch, preview", at: 2_000 },
{ id: "m3", from: "lead", to: "research", label: "Find the cause", at: 3_000 },
{ id: "m4", from: "research", to: "github", label: 'search_code("emptyCart")', at: 5_000 },
{ id: "m5", from: "github", to: "research", label: "3 matches", kind: "reply", replyTo: "m4", at: 6_000 },
{ id: "m6", from: "research", to: "lead", label: "Null total in cart.ts:42", kind: "reply", replyTo: "m3", at: 11_000 },
];
export function Run() {
return <AgentSequence title="Fix the checkout crash" participants={participants} messages={messages} />;
}| Name | Type | Default | Description |
|---|---|---|---|
| participants | SeqParticipant[] | A column each, left to right, with a dashed lifeline – a chip on top opens its card | |
| SeqParticipant.kind | "person" \| "agent" \| "tool" | "agent" | A person gets the full pixel mark in the ink color, an agent its own pixel mark – twinkling while it works – a tool its logo |
| SeqParticipant.logo / color | ReactNode / string | A logo instead of the pixel mark; the agent's color – by default the first agent is blue and the others take the palette in order | |
| SeqParticipant.model / description | string / string | In its card: the model as a tag, and a line on what it does | |
| messages | SeqMessage[] | In order, top to bottom – each new id draws itself across with a light at its tip and lands with a small ripple | |
| SeqMessage.kind / replyTo | "call" \| "reply" / string | "call" | A call is a solid line and the receiver works – a bar on its lifeline – until a reply with its id as replyTo comes back as a dashed line. From and to the same: a loop back to its own lifeline |
| SeqMessage.status | "failed" \| "waiting" | failed is red with a small cross where it lands; waiting – it needs a person – is amber | |
| SeqMessage.at | number | When it was sent, ms since the run started – shown in the gutter on the left, and used for the timing in the cards | |
| SeqMessage.frame | string | Messages next to each other with the same frame sit in one white box with it as a tag – "par", "retry", "loop ×3" | |
| SeqMessage.detail | string | In its card: what exactly went along – the arguments of a call, a result, an error | |
| title | string | The header's name, with how many work or failed, how many messages and the run's time | |
| running | boolean | true | false once the run is over – open bars stop shimmering and marks stop twinkling |
| times | boolean | The time gutter – by default there while no message has come in yet and whenever one has a time, so the first one doesn't push the diagram over; false hides it | |
| onSelect | (message \| null) => void | A click or Enter on a message – its card opens; null when it closes | |
| formatTime | (ms) => string | m:ss | Formats the gutter and the cards' times |
| className | string | Extra class on the root – set the color variables on it |
Columns share the width evenly; below about 100px a column (84px on phones) the diagram scrolls sideways instead of squeezing, with a soft edge on the side there's more
Phones get a narrower time gutter and smaller times; touch screens a bigger target around each participant and the close button
Rows are fixed, so a new message never moves the ones above it – the diagram only grows down
Labels are solid tags in their line's color that read over every line and bar they cross; a long one ends in … with the full text on hover and in its card
Cards float in the top layer and stay inside the diagram – a message's opens on the left when there's no room on the right, or below it on a phone; they follow their anchor on scroll and close once it's scrolled out of the diagram
An agent talking to itself on the last column gets its text on the left of its lifeline
Broken data holds: messages to or from someone who isn't a participant are left out, a time that isn't a number shows none, a negative one reads 0:00, runs past an hour widen the gutter for 1:02:05, an empty label draws just the line, and a reply to a call that doesn't exist is still drawn
Participants are white pills and labels pill-shaped tags, like the rest of the library; frames and cards have soft hairline borders
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"