Agent timeline

The trace of an AI agent's run, in order: the messages, the reasoning, each tool call, handoffs between agents, errors. Built on the timeline, with markers by kind, a dashed rail toward what has not happened yet, a pulse on the running step, and earlier steps folded away.

Agent timeline

Works with no script. With Alpine and the package's script the fold and collapsed rows keep the reader's open or closed over a re-render. See getting started.

Use it

<x-ds::agent-timeline label="Refund question" :fold="5">
    @foreach ($run->steps as $step)
        <x-ds::agent-timeline-item wire:key="step-{{ $step->id }}"
            :type="$step->type" :status="$step->status" :title="$step->title"
            :time="$step->created_at" :duration="$step->seconds" :collapsed="$step->type === 'reasoning'">
            @if ($step->type === 'tool')
                <x-ds::tool-call :name="$step->tool" :status="$step->status" :arguments="$step->input" :result="$step->output" />
            @else
                {{ $step->text }}
            @endif
        </x-ds::agent-timeline-item>
    @endforeach
</x-ds::agent-timeline>

In a box that keeps the newest step in view:

<x-ds::agent-timeline label="Run 42" :follow="true" maxHeight="480">…</x-ds::agent-timeline>

Props

agent-timeline

PropTypeDefaultWhat it does
labelstringrequiredNames the list, and the box with follow.
densitycomfortable compactcomfortableCompact is the timeline's dense.
foldint—Keep only the last this many steps in view; the earlier ones fold behind "Show N earlier steps".
followboolfalseScroll in a box that opens on the newest step and keeps a new one in view, unless the reader has scrolled up.
maxHeightint, string24remWith follow: pixels, or a CSS length.
foldLabelstringShow :count earlier step|Show :count earlier stepsThe fold's words.
unfoldLabelstringHide earlier stepsIts words when open.

agent-timeline-item

PropTypeDefaultWhat it does
typemessage reasoning tool handoff error notenoteThe kind of step: its marker once finished.
statusstringdoneFrom the status set.
titlestringthe type in wordsWhat happened, in one line.
timeDateTime, string—When, as the timeline item takes it.
datetimeDateTime, string—The moment, for a time in words.
timeFormatstring—relative, or a PHP date format.
durationnumber—Seconds it took, after the title: "· 1.2s".
actorstring or array—Who did it, for a run with several agents: a name, or avatar props.
collapsedboolfalseOnly the title line; the body opens under it.
statusTextarray—[status => words].
SlotWhat it does
defaultThe step's body: text, a tool call, a reasoning block.

A finished step's marker is its kind's icon, grey. Anything else shows its status: a pulse while running, amber while waiting, red when failed. An error is red whatever its status.

The fold, and Livewire

Folded steps stay in the page, where your loop rendered them, and are hidden by CSS: moving them into a container of their own would break Livewire's morph of the loop. So a re-render that adds a step just works, and the count moves with it. Give every row a wire:key.

Accessibility

  • An ordered list named by label; each step's status is written before its title for screen readers; times are time elements.
  • The fold and each collapsed step are native disclosures.
  • With follow, the box is a named region and a Tab stop, so it scrolls from the keyboard.
  • New rows and the pulse are motion-safe.

Don't

  • Don't key rows by their position ($loop->index). Key by the step's id.
  • Don't put a link in a collapsed step's title. The title is the control that opens it.
  • Don't show a long run unfolded. Fold all but the last few.

From the package repo: edit this page on GitHub.

Was this page helpful?