Skip to main content

Capability list

What an agent may do, as a list of capabilities in the resource and action form, with a check for each one.

PatternReadyView source
Works with
Reactshadcn/ui
Runs on sample data, with the neutral theme of shadcn/ui.

A readable view of what an agent may do, for a settings page or a review step before a person gives access. Capabilities have the form <resource>:<action>, and the list groups them by resource.

Installation​

The command adds the file to your project, with the shadcn/ui components that it uses. Your project needs shadcn/ui.

pnpm dlx shadcn@latest add https://examples.lumoauth.dev/r/capability-list.json

Usage​

Pass the list that agent.capabilities() returns.

app/agents/[id]/capabilities.tsx
import { CapabilityList } from '@/components/capability-list';

export function Capabilities({ capabilities }: { capabilities: string[] }) {
return (
<CapabilityList
capabilities={capabilities}
needsApproval={['invoices:refund']}
denied={[]}
/>
);
}

needsApproval and denied are yours to fill in: they come from the rules of your own app or from your policies. LumoAuth returns the capabilities only.

Where the data comes from​

What the pattern showsCall
The capabilities of an agentagent.capabilities()
Whether one action is allowed nowagent.isAllowed(action)
Capabilities that a token carriesThe scopes of the verified access token

States​

Runs on sample data, with the neutral theme of shadcn/ui.
  • No capabilities.
  • Everything: the capability *.
  • A long list, with the search field. It appears above 12 capabilities.
  • A wildcard such as tickets:* is marked and explained in words.

Props​

PropTypeDescription
capabilitiesrequiredstring[]The capabilities of the agent, for example invoices:read, invoices:* or *.
needsApprovalstring[]Capabilities that need the approval of a person at the time of use.
deniedstring[]Capabilities that a deny rule overrides. The agent holds them and cannot use them.
searchablebooleanShow the search field. By default it appears above 12 capabilities.
classNamestringClass name for the list.