Loading component…
Loading component…
An agent tries the same task several ways at once and the best one wins – every attempt races as a row with its model and live bar, gets a score, and the best is picked
To reuse this local React demo, copy all files from the Code tab into the same folder, then import ParallelAttempts from ./parallel-attempts.
import { ParallelAttempts, type Attempt } from "@/components/ui/parallel-attempts";
const attempts: Attempt[] = [
{ id: "a", name: "Opus 5.5", approach: "Add a retry with backoff",
status: "running", progress: 0.6, step: "Running tests 12/20" },
{ id: "b", name: "GPT-6 Sol", approach: "Mock the payment API",
status: "done", score: 94, note: "20/20 runs green", took: 125000, cost: 0.27 },
];
export function Fix() {
return <ParallelAttempts attempts={attempts} task="Fix the flaky checkout test" onPick={(a) => apply(a.id)} />;
}| Name | Type | Default | Description |
|---|---|---|---|
| attempts | Attempt[] | { id, name, approach, model?, icon?, status, progress?, step?, score?, note?, took?, cost? } – one per attempt, in the order the rows should show; name is usually the model, icon its logo (on a small tile before the name) | |
| status | "running" \| "done" \| "failed" | Per attempt – picks the bar's tint: blue with a shine, green, red | |
| progress | number | Per attempt, 0 to 1 – the bar's length while it runs (and where a failed one stopped) | |
| step | string | Per attempt – what it does right now, shown on the right while it runs | |
| score | number | Per attempt, 0–100 once done – the highest is marked Best and picked unless you pick another | |
| note | string | Per attempt – one line about the outcome, or the error | |
| task | string | What all of them try to do, next to the title | |
| picked | string \| null | Controlled pick – leave it out and the best finished attempt is picked on its own | |
| onPick | (attempt) => void | Another attempt was picked with "Use this one" | |
| formatCost | (amount: number) => string | dollars | Formats every cost |
| title | string | "Best of N" | Heading of the bar |
| className | string | Extra class on the root |
Built on a container query: wide, name, bar and score sit in one line
Under 560px the bar moves under the name, the approach drops out and the score sits beside the name
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"