Vertical log of what an AI agent did, one row per step: an icon for the kind of step (think, search, read, tool, write), the title, a detail line, live running state and a done summary.
Set your access key from API keys as NEXTUI_TOKEN in .env.local and add the @nextui namespace below to components.json once. Then every item installs by name. Each install counts as a copy on a free account.
$pnpm dlx shadcn@latest add @nextui/agent-timeline
1{2"registries": {3"@nextui": {4"url": "https://nextui.dev/r/{name}.json",5"headers": { "Authorization": "Bearer ${NEXTUI_TOKEN}" }6}7}8}
1"use client";23import type { UIMessage } from "ai";4import { AgentTimeline, type TimelineEvent } from "@/components/nextui/agent-timeline";56// Turn the tool parts of one assistant turn into timeline rows.7export function TurnActivity({ message }: { message: UIMessage }) {8const events: TimelineEvent[] = message.parts.flatMap((part): TimelineEvent[] => {9if (part.type === "reasoning") {10return [{ kind: "think", title: "Thought it through", status: part.state === "streaming" ? "running" : "done" }];11}12if (part.type.startsWith("tool-") && "state" in part) {13const name = part.type.slice(5);14const status = part.state === "output-error" ? "error" : part.state === "output-available" ? "done" : "running";15return [{ kind: name.startsWith("search") ? "search" : "tool", title: name, status }];16}17return [];18});1920return <AgentTimeline events={events} />;21}
| Prop | Type | Default | Description |
|---|---|---|---|
| title | ReactNode | "Agent activity" | Header label |
| events | TimelineEvent[] | – | Rows, oldest first: { kind, title, detail?, meta?, status? }. kind is think, search, read, tool, write, message or error |
| summary | ReactNode | – | Footer line once the run is done, e.g. "Done in 7s" |
| autoPlay | boolean | false | Play a scripted run on a loop while on screen, for demos |
| className | string | – | Extra classes on the wrapper |
Sign in to see the code
Preview it freely. A free account copies code and prompts a few times a day.