affectUI › Components › Agents

Guardrail Funnel

The deterministic guardrails an agent's traffic passes through, as a funnel: requests, input check, PII redaction, tool-call allowlist, output check, delivered. Every stage a fixed row with how many it stopped or changed, how many got through and the share still in; in the middle a soft band per stage as wide as what reached it – the stopped part at its ends in the stage's color, what it redacted as a band – with a slow sheen running down. Click or focus a stage and cards show what it caught: the masked snippet, the rule that fired, and Allow once or Override.

Part of affectUI Pro. Install: npx shadcn@latest add https://www.affectui.com/r/guardrail-funnel.json · Import from @/components/ui/guardrail-funnel

When to use

  • Showing the deterministic checks an agent's traffic passes – input, PII, tool calls, output – and what each one stops
  • A trust page or admin view for a customer-facing agent: how much was redacted, denied or rejected, with real examples
  • Watching guardrails live while an agent is under load or being probed

When not to use

  • Asking a person to approve one action – use Approval Card or Permission Request
  • Which tools an agent may use at all – use Tool Access Map
  • How much an agent may do on its own – use Autonomy Dial

Usage

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 />;
}

Props

NameTypeDefaultDescription
stagesGuardrailStage[]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
titlestringThe name in the bar – default Guardrails
agentstringA tag beside the title with the agent's pixel mark
rangesstring[]Time ranges to switch between, e.g. ["1h", "24h", "7d"] – the switch shows with two or more
rangestringThe picked range
onRangeChange(range: string) => voidCalled when a range is picked
livebooleanA live dot in the bar; the agent's mark twinkles
defaultStagestringThe stage whose catches show first – default the first that caught something
onStageChange(id: string) => voidCalled when a stage is picked by click or Enter
onAction(stageId: string, exampleId: string) => voidCalled when someone uses a card's button – Allow once, Override; set resolved on the example afterwards
classNamestringExtra class on the root – set the color variables on it, e.g. --ui-gdf-t-pink

Keyboard

  • Tab: The range switch, then one stop for the stages, then the cards' Allow once and Override buttons
  • ← / →: The range before or after
  • ↑ / ↓: The stage before or after – the panel shows what it caught
  • Home / End: The first or the last stage
  • Enter / Space: Picks the stage, so its catches stay when you move on
  • Esc: Back to the picked stage's catches

Accessibility

  • The stages are a listbox – each reads its name, what it checks, how many got through, how many it stopped or changed and the share of all requests
  • The funnel is decoration (aria-hidden) – each stage's label reads the same numbers, the share it stopped included
  • The panel is a polite live region, labelled by the stage it shows
  • A redacted value shows only masked – the original text is never in the page
  • The range switch is a radio group; focus rings show for the keyboard only (:focus-visible)
  • A shortened stage name, card title or button label keeps its full text as a tooltip

Responsive

  • 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"

Requirements

  • React 19

Related

  • Tool Access Map – An agent in the middle with every tool it can reach around it – which ones it used, which failed and which it calls right now; open a tool for its calls and replay one on its own
  • Permission Request – An agent asks for one specific right – who, why and exactly what will happen – and you allow it once, for an hour or always; then it folds into one line with the time left and Revoke
  • Approval Gates – The approval requests of an agent run as a stack of cards – the one to decide now on top with who asks, what exactly and why, the diff or arguments on it; approve, reject or change it first, and it drops into the decided list while the next rises – open ones hold the steps behind them
  • Autonomy Dial – How much an agent may do on its own – a three-stop dial, and its real actions gliding between “Runs on its own” and “Asks you first”, with a lock for what always asks