Loading component…
Loading component…
The work waiting for your agents, and how fast it moves – jobs glide into worker slots and land in Done or Failed, while a depth chart shows the backlog build up and drain.
To reuse this local React demo, copy all files from the Code tab into the same folder, then import AgentQueue from ./agent-queue.
import { AgentQueue, type QueueJob, type QueueWorker } from "@/components/ui/agent-queue";
const workers: QueueWorker[] = [
{ id: "w1", name: "Sonnet 5.5" },
{ id: "w2", name: "GPT-6 Sol" },
];
const jobs: QueueJob[] = [
{ id: "j1", name: "Summarize ticket #4821", kind: "llm", status: "running", worker: "w1",
enqueuedAt: t0, startedAt: t0 + 1200, progress: 0.4 },
{ id: "j2", name: "Embed 240 docs", kind: "tool", status: "queued", enqueuedAt: t0 + 800 },
{ id: "j3", name: "Draft reply – Acme", kind: "llm", status: "queued", priority: "high", enqueuedAt: t0 + 2100 },
];
export function Jobs() {
// Times are on one clock (epoch ms here) – without now, the component ticks Date.now while there is work
return <AgentQueue jobs={jobs} workers={workers} backpressure={20} />;
}| Name | Type | Default | Description |
|---|---|---|---|
| jobs | QueueJob[] | { id, name, kind, status, enqueuedAt, priority?, startedAt?, endedAt?, worker?, progress?, estimate?, attempt?, maxAttempts?, detail?, icon?, error? } – waiting, running and recently finished jobs | |
| kind | "llm" \| "tool" \| "agent" \| "human" | Per job – picks its tint: LLM calls violet, tool calls teal, sub-agents slate, human review blue | |
| status | "queued" \| "running" \| "done" \| "failed" | Per job – a job that goes from running back to queued with a higher attempt shows as a retry | |
| priority | "high" \| "normal" \| "low" | "normal" | Per job – a high one glides past the others to the front |
| progress / estimate | number | Per job – 0–1 while it runs, or the expected run time in ms to estimate it | |
| workers | QueueWorker[] | { id, name, detail?, icon? } – the slots; their number is the concurrency | |
| now | number | The clock, on the same scale as the job times – without it, the component keeps its own (Date.now) | |
| rateLimits | { from, until, label? }[] | Stretches when the provider rate-limits – while one is active the running jobs pause in amber with a countdown | |
| paused / onPausedChange | boolean / (paused) => void | The queue is paused; the handler shows a Pause/Resume button | |
| onConcurrencyChange | (workers: number) => void | Shows a – N + stepper for the number of workers | |
| minConcurrency / maxConcurrency | number | 1 / 8 | The stepper's range |
| backpressure | number | A depth that means trouble – a dashed line on the chart; above it Waiting turns amber | |
| window | number | 120000 | How far back the depth chart looks, in ms |
| totals | { done?, failed? } | Counts since the start, when jobs only holds the recent ones | |
| openId / defaultOpenId | string \| null | null | The job whose card is pinned, controlled or uncontrolled |
| onOpenChange | (id: string \| null, job?: QueueJob) => void | A job's card was pinned or closed | |
| onPromote / onCancel | (job: QueueJob) => void | Show "Move to front" and "Cancel" in a pinned card | |
| title / name | string | "Queue" | Heading, and the queue's name muted next to it |
| className | string | Extra class on the root |
Built on a container query and the measured width: wide, the flow runs left to right – queue, workers, Done and Failed
Under 600px the flow stacks: queue on top, the workers below (just their marks, the rail gets the room), Done and Failed side by side
The four numbers wrap to two columns; under 440px Pause and the stepper get a row of their own
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"