affectUI › Components › Agents
Decision Pipeline
One request through a chain of small, typed model calls – extract, check, infer, route – with each value travelling on the line to the next and what the run cost.
Part of affectUI Pro. Install: npx shadcn@latest add https://www.affectui.com/r/decision-pipeline.json · Import from @/components/ui/decision-pipeline
When to use
- Showing how one request runs through a chain of small, typed model calls – extract, check, infer, route – and where it ends
- Making the value each step hands on visible: it travels along the line to the next card and stays there
- Showing what a run cost and how long it took, step by step and added up
When not to use
- One decision with rules between it and the action – use Decision Loop
- Pulling fields out of a document and pointing to their words – use Source Map
- Sending requests to the agents that handle them – use Agent Router
Usage
import { DecisionPipeline, type PipeRun, type PipeStep } from "@/components/ui/decision-pipeline";
const steps: PipeStep[] = [
{ id: "extract", label: "Extract", kind: "extract", ask: "Amount and plan" },
{ id: "check", label: "Check", kind: "check", ask: "Charged twice?" },
{ id: "infer", label: "Infer", kind: "infer", ask: "In refund policy?" },
{ id: "route", label: "Route", kind: "route", ask: "Where to send it?" },
];
const runs: PipeRun[] = [
{
id: "r1",
source: { name: "Intercom", logo: <IntercomLogo /> },
title: "Charged twice for my plan",
text: "Hi, I see two charges of $38 on my card from this morning.",
results: {
extract: { value: "$38 · Pro", wire: "amount: 38", ms: 0.42, cost: 0.00002 },
check: { value: "true", score: 0.97, ms: 0.31, cost: 0.00001 },
infer: { value: "true", score: 0.92, ms: 0.38, cost: 0.00002 },
route: { value: "refund", score: 0.94, wire: '"refund"', ms: 0.29, cost: 0.00001 },
},
action: { label: "Refund $38", via: "Stripe", logo: <StripeLogo />, status: "Refunded" },
},
];
export function Pipeline() {
return <DecisionPipeline steps={steps} runs={runs} />;
}Props
| Name | Type | Default | Description |
|---|---|---|---|
steps | PipeStep[] | { id, label, kind, ask? } – kind (extract, check, infer, route or your own) picks the icon and the line under the name | |
runs | PipeRun[] | { id, title, text?, source?, results, action } – played one after another | |
runs[].results | Record<string, PipeResult> | Per step id: { value, score?, wire?, missing?, ask?, ms, cost } – ms in milliseconds, cost in dollars | |
runs[].action | { label, status, via?, logo?, person? } | Where the run ends – an action with its logo, or a person | |
autoPlay | boolean | Plays the runs one after another – on by default; reduced motion shows each one finished | |
className | string | An extra class on the root |
Accessibility
- Each step and the action is a button – Enter opens a small tray with what came in and what went on, Esc or a click outside closes it
- Pause stops the runs; paused, Previous and Next sit right after it in the Tab order
- Every step says whether it is waiting, working, done or skipped
- Once a run is done it's announced – "Charged twice for my plan: Refund $38, Refunded – 4 calls in 1.40 ms for $0.00006"
- A focus ring shows only for the keyboard
Responsive
- Fills its container's width, three cards a row; below 720px the cards stack with straight lines between them and the values beside the lines
- Stacked, a card's tray opens below it and pushes the next cards down
- Long names, questions and values end in …; times read 0.31 ms, 12.5 s or 2.1 min, costs $0.00002 or $1,284.50
- Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"
Requirements
- React 19
Related
- Decision Loop – How an AI decision becomes an action – the event, the model's typed choice and score, plain-code rules that tick or cross, then the action or a person, and back to learn
- Source Map – What a model pulled out of a document, with a line from every typed field to the words it came from – and "Not in input" where it would otherwise have to guess
- Agent Router – A router agent sorting incoming requests to the agents that handle them – a light runs to the chosen agent with a confidence, and unsure requests go to a person