affectUI › Screens › App screens
Agent / Guardrails
The rules a team of agents has to keep, with every catch landing live in a one-minute lane and the ones that need you approved right from the side panel.
Part of affectUI Pro. Install: npx shadcn@latest add https://www.affectui.com/r/agent-guardrails.json · Import from @/components/ui/agent-guardrails
When to use
- The policies a multi-agent system runs under – what is blocked, masked, flagged or held for a person – and how often each one fires
- Tuning rules: testing a text against a rule, trying a new rule in Monitor before it enforces, switching a noisy one off, approving what a rule held back
When not to use
- Every run of the agents on a timeline – use Agent / Executions
- One decision a person has to make, with its context – use Approval Gates
Usage
import { AgentGuardrailsScreen } from "@/components/ui/agent-guardrails";
export default function Page() {
return (
<AgentGuardrailsScreen
agents={agents} // [{ id, name, color }]
rules={rules} // [{ id, name, description, when, action, agents, on, mode, base? }]
hits={hits} // [{ id, rule, agent, at, text, match, outcome }]
onToggle={(rule, on) => api.setRule(rule.id, { on })}
onModeChange={(rule, mode) => api.setRule(rule.id, { mode })}
onDecide={(hit, approved) => api.decide(hit.id, approved)}
onTest={(rule, text) => policy.match(rule.id, text)} // the part that sets it off, or null
/>
);
}Props
| Name | Type | Default | Description |
|---|---|---|---|
title | string | "Guardrails" | The page's title in the bar |
agents | AgdAgent[] | The agents – id, name and the color of their mark | |
rules | AgdRule[] | The rules, in this order – name, description, the condition (when), the action (block, ask, redact, warn), the agents it watches, on, mode (enforce or monitor) and base, the catches in the last hour before the ones in hits | |
hits | AgdHit[] | The catches – rule, agent, time (epoch ms), the text, the part that set the rule off and the outcome. Left out, a sample that plays on while Live is on | |
now | number | Where now stands, epoch ms – defaults to the clock | |
defaultOpen | string | null | "refund" | The rule open in the work area when the screen starts |
onToggle | (rule, on) => void | A rule switched on or off | |
onModeChange | (rule, mode) => void | Enforce or Monitor only | |
onDecide | (hit, approved) => void | Approve or reject a catch that waits on you | |
onNewRule | () => void | New rule in the bar | |
passed | number | Checks that passed in the last hour, for the bar on top – left out with your own catches, the bar shows the catches only | |
onTest | (rule, text) => string | null | Test this rule in the panel: return the part of the text that sets the rule off, or null when it passes – defaults to checks for the sample rules | |
loading | boolean | Gray rows and panel | |
empty | boolean | No rules yet |
Keyboard
- ↑ / ↓: From rule to rule – the list is one stop in the tab order; on a switch they move from switch to switch
- Home / End: To the first or the last rule
- Enter: Open the rule on the right – again on the open rule folds it away
- ← / →: Between Enforce and Monitor only
Accessibility
- Each row is named with the rule, what it does, how often it caught something and whether it is off
- The lane and the bar repeat the numbers and are hidden from screen readers
- Catches waiting on you are announced politely; rings show for the keyboard only
- Each rule's switch sits outside its row and is named after the rule
- The test result is announced as you type; the test field has no ring, its edge firms up
Responsive
- The rule opens in the App Shell's work area – resizable, and it folds away
- Narrower screens drop the agents column; on phones the lane moves under the rule's name and the count goes
- A catch whose agent is gone shows with a gray mark as Removed agent; catches may come in any order
- Long rule names wrap in the panel, conditions break anywhere, and times stay on one line
- Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"
Requirements
- React 19
- @hugeicons/react
- @hugeicons/core-free-icons
- App Shell (installed with it)
Related
- Agent / Executions – Every run of a team of agents as one waterfall on a shared timeline, with a side panel to approve, retry or follow each run
- Approval Gates – The approval requests of an agent run as a stack of cards – the one to decide now on top with the diff or arguments, approve, reject or change it, then the next rises
- Agent / Run Detail – One agent run, step by step – thinking, tool calls, sub-agents and failures as bars on one time axis, with time, cost and tokens on top and what went in and out of each step