Skip to the page
Supply UI

Agent activity

In code: AgentActivity

A list of what was changed on the page and by whom, newest first, with a button that puts back everything the assistant changed. Put it where the person can see what an assistant did for them.

Preview

Nothing has been changed yet

Use

The code of the preview above
import { useState } from 'react';
import { AgentActivity, Button, Field, Select, Stack, Switch, getAgent } from '@/components/ui';
import { Sparkles } from 'lucide-react';

function AgentActivityDemo() {
  const [reminders, setReminders] = useState(true);
  const [region, setRegion] = useState('europe');
  const askAssistant = () =>
    getAgent().act({
      steps: [
        { ref: 'Reminder emails', action: 'setChecked', args: [false] },
        { ref: 'Region', action: 'setValue', args: ['Asia Pacific'] },
      ],
    });
  return (
    <Stack gap={4}>
      <Switch checked={reminders} onCheckedChange={setReminders}>Reminder emails</Switch>
      <Field label="Region">
        <Select
          value={region}
          onValueChange={setRegion}
          items={[
            { value: 'europe', label: 'Europe' },
            { value: 'americas', label: 'Americas' },
            { value: 'asia', label: 'Asia Pacific' },
          ]}
        />
      </Field>
      <Button onClick={askAssistant}><Sparkles />Let the assistant change them</Button>
      <AgentActivity />
    </Stack>
  );
}

This page as text, for an AI

Options

OptionTypeWhat it does
className stringMore classes on the outer element, for layout around it (margins, grid placement), not to restyle it.
empty ReactNodeShown while nothing has changed.
limit number · default 6How many of the latest changes to list.
undoLabel ReactNodeThe words on the button that puts back what the assistant changed: "Undo what the assistant did" by default.

Without React

With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:

components/button.csscomponents/card.csscomponents/tabs.csscomponents/dialog.csscomponents/button-group-toggle.csscomponents/tab-bar.csscomponents/prose.csscomponents/carousel-arrows.csscomponents/page-transitions.cssparts/carousel.cssparts/changed-by-whom.cssparts/board.css

AI assistants: states, do and don’t

A list of what was changed and by whom (the person, the assistant, the app), newest first, with a button that puts back everything the assistant changed and keeps what the person changed after it.

The parts that let an assistant see and use the screen the way a person does: the bridge (AgentBridge, getAgent()), the record of changes with undo, and suggestions.

Do

  • Mark everything that deletes, pays or sends with data-agent-confirm, so an assistant asks first.
  • Check the assistant's list once (getAgent().snapshot()): every control has a name a person would recognise.

Don't

  • Don't let an assistant act on anything a person could not do with the same screen.