Skip to main content

Agent identity

A badge and a card that say which agent this is, how it proves its identity, and whom it acts for.

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

The answer to "who did this?" wherever an agent appears next to people: comment threads, activity feeds, ticket histories. The pattern has two parts: a badge for a line of text, and a card.

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/agent-identity.json

Usage​

Use the badge wherever you show the name of an actor, and the card on the page of an agent.

components/activity-line.tsx
import { AgentBadge, AgentIdentityCard, type AgentIdentityData } from '@/components/agent-identity';

export function ActivityLine({ agent, text }: { agent: AgentIdentityData; text: string }) {
return (
<p>
<AgentBadge agent={agent} /> {text}
</p>
);
}

export function AgentPage({ agent }: { agent: AgentIdentityData }) {
return <AgentIdentityCard agent={agent} />;
}

A struck-through badge marks an agent that is suspended, revoked or not registered. The badge also carries the words "AI agent" for screen readers.

Where the data comes from​

What the pattern showsCall
The agent itselfGET /agents/me, or agent.getCurrentAgent()
Its capabilitiesagent.capabilities()
An agent that called your APIThe claims of the verified access token: the agent flag, and act for the person behind it
Any agent, for an administratorAdmin API, agents

States​

Runs on sample data, with the neutral theme of shadcn/ui.
  • Acts for itself, with a workload identity.
  • Suspended.
  • Revoked.
  • Not registered. The card says to treat its actions as those of an unknown caller.
  • In a line of text, with and without a person behind the agent.

Props​

PropTypeDescription
agentrequiredAgentIdentityDataThe agent. Both the badge and the card take it.
classNamestringClass name for the root element.

AgentIdentityData​

OptionTypeDefaultDescription
namerequiredstringThe name of the agent.
idstringThe agent ID.
identityType'workload' | 'aauth' | 'private_key_jwt' | 'client_secret' | 'api_key' | 'custom'How the agent proves its identity.
status'active' | 'inactive' | 'suspended' | 'revoked''active'The state of the agent.
onBehalfOfstring | nullThe person that the agent acts for now.
registeredbooleanFalse for an agent that is not in the registry of your organization.
capabilitiesstring[]Capabilities to list on the card.