Skip to content

Agent Policy

The permission rules for an agent: Allow, Ask or Deny per tool and arguments, file and network scopes as patterns, a spend and a step cap, and a panel that tries a tool call and shows which rule decides it.

On this page
Used for
  • Agent settings page
  • Workspace security defaults
  • Reviewing what a scheduled agent may touch
  • Explaining why a call was blocked

Examples

Policy
Run so far

Try a case

Every rule that matches is collected and the strictest outcome wins: Deny, then Ask, then Allow. The first rule with that outcome is the one shown, so a broad Allow on a folder never hides a Deny on a file inside it. Caps are checked before any rule.

Read-only summary

Installation

Installation is part of Pro

Pro components install from a licensed registry. The live preview stays open to everyone.

Props

value
Policy
The rules: fallback, tools, files, hosts and caps.
onChange
(policy: Policy) => void
Every edit, with the whole new policy. Without it the editor is read-only.
title
ReactNode
Default"Agent policy"
Heading.
description
ReactNode | null
Defaulta summary
Line under the heading. Default counts the rules and caps ("6 tool rules, 2 file scopes, 3 hosts, $5.00 and 200 steps"). null hides it.
showTester
boolean
Defaulttrue
Show the Try a case panel and the row highlight.
testCase
PolicyCase
The call in the tester, controlled: { tool, args?, paths?, hosts?, costUsd? }.
defaultTestCase
PolicyCase
Defaultshell, git push origin main
Starting call when the tester is not controlled.
onTestCaseChange
(call: PolicyCase) => void
Called as the tool or arguments are typed.
usage
{ spentUsd?, steps? }
What the run has used so far. The caps count from here.
onDecision
(decision: PolicyDecision) => void
Called when the tester's outcome, reason or deciding rule changes.
className
string
On the card.
evaluatePolicy
(policy, call, usage?) => PolicyDecision
Fromagent-policy-utils
The same matching the editor uses. Use it where the agent runs, so the editor and the runtime agree.
caseTargets
(args) => { paths, hosts }
Fromagent-policy-utils
Paths and hosts found in a call's arguments.
textGlob, pathGlob, hostGlob
(pattern, text) => boolean
Fromagent-policy-utils
The three pattern kinds on their own.
OUTCOME_COPY
Record<PolicyOutcome, ...>
Fromagent-policy-utils
Allow, Ask and Deny with the same words as Permission Request.

Patterns

  • Tools and arguments: * is any text and ? one character, case does not matter, and the whole text must match. github.* covers every GitHub tool; git push* covers any push.
  • Paths: ** crosses folders and can match none, * stays inside one folder name. ./ and backslashes are folded away.
  • Hosts: *.acme.dev is any subdomain at any depth but not acme.dev itself; * is every host. Scheme, port and path are ignored.

Accessibility

  • Each group (Tools, Files, Network, Caps) is a labelled group. Every field has its own name, such as "Tool pattern 3" or "Arguments pattern 3".
  • Each outcome is a radio group named after its rule; arrow keys move between Allow, Ask and Deny.
  • Remove buttons are named after the rule they remove. Delete or Backspace on a focused Remove removes the row too, and focus moves to the next row's Remove, or to Add when the list is empty.
  • The tester's outcome and reason sit in a polite live region, so a screen reader hears "Ask. Asks first: tool rule shell, git push*" as the case changes. The highlighted row also says "Decides" in text, not only in colour.
  • Invalid patterns and caps mark the field invalid and say why under it.

What it handles

  1. 01Tool rules as a tool pattern plus an optional arguments pattern, each set to Allow, Ask or Deny.
  2. 02File scopes as path patterns (`**` crosses folders) and network scopes as host patterns (`*.acme.dev`).
  3. 03A spend cap and a step cap per run, counted from the usage you pass.
  4. 04A default for anything no rule matches.
  5. 05Try a case: type a tool call, see the outcome, the reason and the rule that decided it, highlighted in place.
  6. 06Paths and hosts named in the arguments are found and checked against the scopes.

States

First render
Nothing moves. The deciding row is already marked
none
Case changes
The highlight moves to the new deciding row; the outcome badge and reason swap
120ms colour, ease out
Rule edited
The result updates as you type
120ms colour
Rule added
The row appears and its first field takes focus
none
Rule removed
The row goes; focus moves to the next row's Remove, or Add
none
Over a cap
The Caps group is marked and the case is Blocked
120ms colour
Read-only
No Add or Remove; fields cannot be edited
none
Reduced motion
The highlight changes at once
0ms

Works with

When to use

When to use

  • The settings page of an agent: which tools run on their own, which ask first and which never run, with the folders and hosts it may touch.
  • Explaining a blocked call: type it in Try a case and show the rule that decided it.

When not to use

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Agent Policy to my app and wire it to my own data.
  • I need the settings page of an agent: which tools run on their own, which ask first and which never run, with the folders and hosts it may touch. Set that up with the Knowns UI Agent Policy.
  • Which Agent Policy props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "agent-policy" }) and search_docs({ query: "agent policy" }). Pro props, full examples and source come back once your license key is in the MCP config.

Need help?

Stuck on Agent Policy, or found something off? We read every message.