← All proposals

Context: AgentInbox

Net-new componentOpen in Storybook

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

import * as AgentInboxStories from './AgentInbox.stories';

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

<Title />

## Purpose

Every task your agents are working on, grouped by what it needs from you: **Needs you**, **Running** and **Done**. A person can tell at a glance which tasks wait for a decision, and open a card in place to see the last steps and decide. This is an ideation sketch (`in-progress`): it is built and usable, but not yet handed off.

## Usage

- Use it as the home for background agent work across a product (a board of tasks from several features). For one agent and its sub-agents, use the Agent Tree. For a log of events in order, use the Event Log.
- The component groups tasks for you: the `status` of each task decides its lane. `waiting` and `failed` tasks are in **Needs you**, `running` in **Running**, `done` in **Done**. Pass `lanes` to show fewer, or in another order.
- A card shows the status icon, the title, the feature it belongs to (`subtitle`) and the site or sites it touches (`sites`: a name, or a count when there is more than one), a short description, the status badge, the elapsed time and the source and tool counts.
- Opening a card shows the last four steps as an Event Log; a running task ends on a Thinking State. One card is open at a time.
- The buttons on an open card depend on the status: **Approve** and **Reject** on a waiting task, **Retry** on a failed one, and **Open** on a running or done one when you pass `onOpen`. The inbox only reports the choice (`onApprove`, `onReject`, `onRetry`, `onOpen`); the screen decides what it does and updates the task. Without a handler the inbox shows exactly the tasks it is given.
- Elapsed time is a string the screen formats (`time`). The inbox runs no clock.
- The **Board** and **List** switch changes the layout (`defaultView`, `onViewChange`). In a narrow container the board always becomes the list and the switch is hidden.

<Canvas of={AgentInboxStories.List} />

- Every visible word is in `labelStrings` or in the task data, so the screen can translate it.
- Not for tasks a person never needs to act on or review. Not for notifications that disappear on their own.

<Canvas of={AgentInboxStories.NarrowContainer} />

## Accessibility

- Each lane is a `region` named by its heading ("Needs you", with the number of tasks beside it). Cards are a list (`ul` and `li`), so a screen reader announces the number of tasks in a lane.
- The card's title row is a single button with `aria-expanded` and `aria-controls`. **Enter** and **Space** open and close it. Approve, Reject, Retry and Open are real buttons with text; the next Tab moves into the open card.
- The status is text, not only color or an icon: the status badge carries `labelStrings.statusIndicator` for screen readers, and a running task's spinner has a label.
- The Board and List switch is a segmented button with a label (`labelStrings.view`).
- When a task changes status the screen moves it to another lane. Nothing announces that move: the screen should announce it (for example in its own polite live region) when a task needs a decision.
- Not checked with a screen reader, not run through the a11y panel and not checked by keyboard in a browser.

## Implementation

Built from the package `Panel`, `StatusBadge`, `Badge`, `SegmentedButton`, `Button` and `ThinkingState`, and the local `EventLog`, `EventLogItem`, `Icon` and `Spinner`. See the table below for the available props.

- `defaultView` — Layout on first render: `board` (default) or `list`.
- `labelStrings` — Translatable strings: lane names, status words, buttons and the layout switch.
- `lanes` — Which lanes show, in order: `needs`, `running`, `done`. Leave it out for all three.
- `onApprove` — Called when the user approves a task that is waiting.
- `onOpen` — Called when the user opens a running or done task. Shows an Open button.
- `onReject` — Called when the user rejects a task that is waiting.
- `onRetry` — Called when the user retries a failed task.
- `onViewChange` — Called when the layout switch changes.
- `tasks` — The tasks to show. The status of each decides its lane.

Each task has an `id`, `agent`, `title` and `status`, and optionally a `subtitle`, `sites`, `description`, `time`, `sourceCount`, `toolCount` and `steps` (each with a `label`, and optionally a `status` and a `time`).

| What                 | Value                                                                                             |
| -------------------- | ------------------------------------------------------------------------------------------------- |
| Board becomes a list | Container width `640px` or less (a container query; no token, listed in `custom.md`)              |
| Steps shown          | The last four of a task                                                                           |
| Footprint            | Fills the width it is given; lanes sit side by side in a wide container and stack in a narrow one |

<hr />

<Canvas of={AgentInboxStories.Board} />
<Controls of={AgentInboxStories.Board} />