← All proposals

Event log with agent

A recipe, not a component: a story and Usage page that compose existing proposals.

Extends a PDS componentOpen in Storybook

proposals/EventLogWithAgent/EventLogWithAgent.mdx42 lines · View on GitHub
import { Canvas, Meta, Title } from '@storybook/addon-docs/blocks';

import * as EventLogStories from './EventLogWithAgent.stories';

<Meta of={EventLogStories} name='Usage' />

<Title />

## Purpose

Shows an agent joining an event log: where it started, what it did and where it handed back.

## Usage

This is a recipe, not a component. It composes Event Log, Event Log Item, Labeled Divider, Chain of Thought and Thinking State.

- Put the whole log in one `EventLog` with `hasRail`.
- Open the agent's region with an agentic Labeled Divider ("Zappy engaged") and close it with a second one when the agent hands back. Both use `tone='agentic'` (the gradient) and `size='xs'`, so they sit well beside the rows; the component default size is `s`, so set `xs` when you copy this.
- Mark the agent's own entries `isAgentic`. A Chain of Thought and a Thinking State sit in the list as they are.
- While the agent is working, end the log with a Thinking State. When it finishes, replace it with a done item and add the closing divider.
- The rail joins neighbouring items and stops at a divider, a Chain of Thought or a Thinking State.

## Accessibility

- The log is an ordered list, so a screen reader announces how many entries there are. Each divider is announced as a separator named by its label ("Zappy engaged", "Zappy finished"), so the agent's region is marked in text, not only by color.
- Keyboard: only the expandable rows are focusable (an Event Log Item with detail, and the Chain of Thought summary). Enter and Space open and close them, and the focus ring is visible.
- What is announced: each entry's status text and label once. Write labels that do not repeat the status.
- Translate the divider labels, the entries and the times in the screen; none of the text lives in the components.
- Color contrast and the a11y panel in light and dark: not checked.

## Implementation

The stories show the agent working and finished.

<hr />

<Canvas of={EventLogStories.AgentWorking} />

<hr />

<Canvas of={EventLogStories.AgentFinished} />