Skip to main content

Agent activity timeline

What an agent did, in order: tokens, tool calls, approvals and refusals, each with its trace.

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

The audit record of one agent, in a form that a person can read. Use it on the page of an agent and after an incident. Events of one task stand together, and each can link to its trace.

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-activity.json

Usage​

Map the audit events of your organization to the events of the timeline.

app/agents/[id]/activity.tsx
import { AgentActivity, type ActivityEvent } from '@/components/agent-activity';

export function Activity({ events, onLoadMore }: { events: ActivityEvent[]; onLoadMore: () => void }) {
return (
<AgentActivity
events={events}
traceHref={(traceId) => `https://cloud.langfuse.com/trace/${traceId}`}
onLoadMore={onLoadMore}
/>
);
}

Your API route reads the audit log with a credential that may read it, filtered by the agent. Write the summary of each event in your own words: the audit log gives the event type and its data, and your product knows what they mean to its users.

Where the data comes from​

What the pattern showsCall
The events of one agentAdmin API, audit logs, filtered by the agent
From the terminallumo logs
The trace of an eventThe trace ID that LumoAuth stores with each audit row, from the traceparent header of the request
New events as they happenWebhooks, for the event types that you chose

States​

Runs on sample data, with the neutral theme of shadcn/ui.
  • A quiet agent. Nothing has happened yet.
  • A run of refusals. The filter "Refused" counts them, and each shows its reason.

Props​

PropTypeDescription
eventsrequiredActivityEvent[]The events, newest first.
traceHref(traceId: string) => stringBuilds the link to a trace in your tracing tool.
onLoadMore() => voidLoad older events. The button appears when you pass it.
classNamestringClass name for the timeline.

ActivityEvent​

OptionTypeDescription
idrequiredstringThe ID of the event.
timerequiredstringWhen it happened.
typerequiredstringThe event type of the audit log.
summaryrequiredstringThe event in plain words.
outcomerequired'success' | 'refused' | 'approval' | 'failed'The outcome.
reasonstring | nullThe reason of a refusal or a failure.
onBehalfOfstring | nullThe person that the agent acted for.
taskIdstring | nullEvents with the same task are shown as one group.
taskNamestring | nullA name for the task.
traceIdstring | nullThe trace ID of the event.