Loading component…
Loading component…
The guardrails an agent's traffic passes through, as a funnel – input check, PII redaction, tool allowlist, output check – with how many each stage stopped and what it caught
To reuse this local React demo, copy all files from the Code tab into the same folder, then import GuardrailFunnel from ./guardrail-funnel.
import { GuardrailFunnel, type GuardrailStage } from "@/components/ui/guardrail-funnel";
const stages: GuardrailStage[] = [
{ id: "requests", label: "Requests", passed: 18240 },
{ id: "input", label: "Input check", hint: "Prompt injection, jailbreak", passed: 16636, blocked: 1604 },
{ id: "pii", label: "PII redacted", passed: 16636, changed: 2931 },
{ id: "tool", label: "Tool call allowed", passed: 15724, blocked: 912, verb: "denied" },
{ id: "output", label: "Output check", passed: 15236, blocked: 488, verb: "rejected" },
{ id: "delivered", label: "Delivered", passed: 15236 },
];
export function Guardrails() {
return <GuardrailFunnel stages={stages} agent="Support agent" ranges={["1h", "24h", "7d"]} range="24h" live />;
}| Name | Type | Default | Description |
|---|---|---|---|
| stages | GuardrailStage[] | The stages in order, the first what came in, the last what got out – { id, label, hint?, passed, blocked?, changed?, verb?, changedVerb?, tone?, icon?, examples?, parts? }. A stage's band is as wide as passed + blocked: blocked shows at its ends in the stage's color, changed as a band in the middle. icon – requests, input, pii, tool, output or delivered – is the small glyph before its name (default by position). examples – { id, text, match?, replace?, rule?, at?, code?, logo?, action?, resolved? } – up to three cards of what it caught. parts – { id, label, value, note? } – up to three rows of what it is made of, shown when it has no examples, e.g. where requests came from or how answers got through | |
| title | string | The name in the bar – default Guardrails | |
| agent | string | A tag beside the title with the agent's pixel mark | |
| ranges | string[] | Time ranges to switch between, e.g. ["1h", "24h", "7d"] – the switch shows with two or more | |
| range | string | The picked range | |
| onRangeChange | (range: string) => void | Called when a range is picked | |
| live | boolean | A live dot in the bar; the agent's mark twinkles | |
| defaultStage | string | The stage whose catches show first – default the first that caught something | |
| onStageChange | (id: string) => void | Called when a stage is picked by click or Enter | |
| onAction | (stageId: string, exampleId: string) => void | Called when someone uses a card's button – Allow once, Override; set resolved on the example afterwards | |
| className | string | Extra class on the root – set the color variables on it, e.g. --ui-gdf-t-pink |
Rows and cards keep their height whatever the data – three card slots, so switching stages never moves the layout; names, snippets and hints shorten with an ellipsis
A long button label takes at most about two fifths of its card, so the snippet stays readable
Narrow: a slimmer funnel; the agent tag keeps its mark, live its dot; the hint, the times and the parts' notes go
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"