> For AI agents: the complete documentation index is available at https://wallarm.github.io/design-system/llms.txt, the full documentation bundle is available at https://wallarm.github.io/design-system/llms-full.txt.

# AgentAvatar

The 3D character of an AI agent, for places with room to show who is working: team cards, the agent drawer and the empty chat. It starts at 40 px; below that, in text, chips and table rows, reach for the flat `AgentGlyph`. Its eyes carry the state and its prop tells the job, so status color never goes on the body. Size, motion and the contact shadow follow the place it sits in, and next to the agent’s visible name it is decorative.

[Source](https://github.com/wallarm/design-system/tree/main/packages/design-system/src/components/AgentAvatar) · [Storybook](https://wallarm.github.io/design-system/storybook/?path=/docs/ai-characters-agentavatar--overview)

```tsx
import { AgentAvatar } from '@wallarm-org/design-system/AgentAvatar';

export const Basic = () => (
  <AgentAvatar data-testid='agent-avatar' />
);
```

## Usage

```tsx
import { AgentAvatar } from '@wallarm-org/design-system/AgentAvatar';
```

## Examples

### Cast

The cast of ten on duty at the team-card size. Each is told apart by its shape, color and prop; a planned agent says so after its role.

```tsx
import { AgentAvatar } from '@wallarm-org/design-system/AgentAvatar';
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
import { Text } from '@wallarm-org/design-system/Text';
import { CAST } from '../../lib/agent-characters/data.gen';

export const Cast = () => (
  <HStack gap={24} align='start' wrap='wrap'>
    {CAST.map(p => (
      <VStack key={p.id} gap={4} align='center' className='w-120 text-center'>
        <AgentAvatar data-testid={`agent-avatar-${p.id}`} agent={p.id} seed={p.id} size={72} />
        <Text size='sm'>{p.name}</Text>
        <Text size='xs' color='secondary'>
          {p.planned ? `${p.role} · planned` : p.role}
        </Text>
      </VStack>
    ))}
  </HStack>
);
```

### Beside text

Beside a name and role (the hover card), `align='drawing'` centres what is drawn, not the box: a short character no longer hangs below the text. Left: the box centred; right: the drawing.

```tsx
import { AgentAvatar } from '@wallarm-org/design-system/AgentAvatar';
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
import { Text } from '@wallarm-org/design-system/Text';
import { CAST } from '../../lib/agent-characters/data.gen';

export const BesideText = () => (
  <VStack gap={16}>
    {CAST.map(p => (
      <HStack key={p.id} gap={48}>
        {(['box', 'drawing'] as const).map(align => (
          <HStack key={align} gap={12} className='w-240'>
            <AgentAvatar
              data-testid={`agent-avatar-${p.id}-${align}`}
              agent={p.id}
              seed={p.id}
              size={56}
              align={align}
            />
            <VStack gap={2}>
              <Text size='sm' weight='medium'>
                {p.name}
              </Text>
              <Text size='xs' color='secondary'>
                {p.role}
              </Text>
            </VStack>
          </HStack>
        ))}
      </HStack>
    ))}
  </VStack>
);
```

### States

Every state frame of the cast. The eyes and a few body cues carry the state; red and crosses never appear.

```tsx
import { Fragment } from 'react';
import { AgentAvatar } from '@wallarm-org/design-system/AgentAvatar';
import { Text } from '@wallarm-org/design-system/Text';
import { CAST } from '../../lib/agent-characters/data.gen';

export const States = () => (
  <div className='grid grid-cols-[repeat(10,auto)] items-center gap-x-16 gap-y-8'>
    <span />
    {STATES.map(state => (
      <Text key={state} size='xs' color='secondary' align='center'>
        {STATE_LABELS[state]}
      </Text>
    ))}
    {CAST.map(p => (
      <Fragment key={p.id}>
        <Text size='sm'>{p.name}</Text>
        {STATES.map(state => (
          <AgentAvatar
            key={state}
            data-testid={`agent-avatar-${p.id}-${state}`}
            agent={p.id}
            seed={p.id}
            size={72}
            state={state}
          />
        ))}
      </Fragment>
    ))}
  </div>
);
```

### Partial coverage

Partial coverage: the agent covers only some of its applications, so the top of its head stays in gray felt.

```tsx
import { AgentAvatar } from '@wallarm-org/design-system/AgentAvatar';
import { HStack } from '@wallarm-org/design-system/Stack';
import { CAST } from '../../lib/agent-characters/data.gen';

export const PartialCoverage = () => (
  <HStack gap={24} wrap='wrap'>
    {CAST.map(p => (
      <AgentAvatar
        key={p.id}
        data-testid={`agent-avatar-partial-${p.id}`}
        agent={p.id}
        seed={p.id}
        size={72}
        hasApplications
        coverage='partial'
      />
    ))}
  </HStack>
);
```

### Custom agent

Agents without a preset get a deterministic look from their uid, the same one their glyph shows.

```tsx
import { AgentAvatar } from '@wallarm-org/design-system/AgentAvatar';
import { HStack } from '@wallarm-org/design-system/Stack';
import { defaultLook } from '../../lib/agent-characters/look';

export const CustomAgent = () => (
  <HStack gap={24}>
    {CUSTOM_AGENTS.map(uid => (
      <AgentAvatar
        key={uid}
        data-testid={`agent-avatar-custom-${uid.slice(0, 8)}`}
        look={defaultLook(uid)}
        seed={uid}
        size={72}
      />
    ))}
  </HStack>
);
```

### Team

A full Agent team page: 16 cards opened with cold caches, the case the first-draw budget is set for.

```tsx
import { AgentAvatar } from '@wallarm-org/design-system/AgentAvatar';

export const Team = () => (
  <div className='grid grid-cols-4 gap-24'>
    {TEAM.map(m => (
      <AgentAvatar
        key={m.id}
        data-testid={`agent-avatar-team-${m.id}`}
        look={m.look}
        seed={m.id}
        size={72}
      />
    ))}
  </div>
);
```

### Live states

Every persistent state of the cast, live, in one group. On duty plays its idle repertoire and glances at the
neighbors; Needs you plays the same repertoire, looks at you between behaviors and is the only one that hops.

```tsx
import { Fragment } from 'react';
import { AgentAvatar, AgentAvatarGroup } from '@wallarm-org/design-system/AgentAvatar';
import { VStack } from '@wallarm-org/design-system/Stack';
import { Text } from '@wallarm-org/design-system/Text';
import { CAST } from '../../lib/agent-characters/data.gen';

export const LiveStates = () => (
  <AgentAvatarGroup>
    <div className='grid grid-cols-[repeat(8,auto)] items-center gap-x-16 gap-y-8'>
      <span />
      {LIVE_STATES.map(state => (
        <Text key={state} size='xs' color='secondary' align='center'>
          {STATE_LABELS[state]}
        </Text>
      ))}
      {CAST.map(p => (
        <Fragment key={p.id}>
          <VStack gap={0}>
            <Text size='sm'>{p.name}</Text>
            <Text size='xs' color='secondary'>
              {p.planned ? `${p.role} · planned` : p.role}
            </Text>
          </VStack>
          {LIVE_STATES.map(state => (
            <AgentAvatar
              key={state}
              data-testid={`agent-avatar-live-${p.id}-${state}`}
              agent={p.id}
              seed={`${p.id}-${state}`}
              size={72}
              state={state}
              live
            />
          ))}
        </Fragment>
      ))}
    </div>
  </AgentAvatarGroup>
);
```

### Beats

Hello (from On duty) and Done are one-shots: they play in full, then the character shows its state again.

```tsx
import { createRef, useState } from 'react';
import { AgentAvatar, AgentAvatarGroup, type AgentAvatarHandle } from '@wallarm-org/design-system/AgentAvatar';
import { Button } from '@wallarm-org/design-system/Button';
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
import { CAST } from '../../lib/agent-characters/data.gen';

export const Beats = () => {
  const [handles] = useState(() => CAST.map(() => createRef<AgentAvatarHandle>()));
  const [ended, setEnded] = useState('');
  const sayHello = () => handles.forEach(h => h.current?.play('hello'));
  const finishRun = () => handles.forEach(h => h.current?.play('done'));
  const onBeatEnd = (beat: string) => setEnded(beat);
  return (
    <VStack gap={16} align='center'>
      <AgentAvatarGroup>
        <HStack gap={24} wrap='wrap'>
          {CAST.map((p, i) => (
            <AgentAvatar
              key={p.id}
              data-testid={`agent-avatar-beats-${p.id}`}
              agent={p.id}
              seed={p.id}
              size={72}
              live
              handleRef={handles[i]}
              onBeatEnd={onBeatEnd}
            />
          ))}
        </HStack>
      </AgentAvatarGroup>
      <HStack gap={8}>
        <Button
          data-testid='agent-avatar-beats-hello'
          variant='outline'
          size='small'
          onClick={sayHello}
        >
          Hello
        </Button>
        <Button
          data-testid='agent-avatar-beats-done'
          variant='outline'
          size='small'
          onClick={finishRun}
        >
          Done
        </Button>
      </HStack>
    </VStack>
  );
};
```

### Inviting

Not set up, inviting: one agent on the page invites at a time, glancing at Set up; hover or focus on it and the
agent turns to it.

```tsx
import { useRef } from 'react';
import { AgentAvatar } from '@wallarm-org/design-system/AgentAvatar';
import { Button } from '@wallarm-org/design-system/Button';
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
import { CAST } from '../../lib/agent-characters/data.gen';

export const Inviting = () => {
  const cue = useRef<HTMLButtonElement>(null);
  return (
    <VStack gap={24} align='center'>
      <HStack gap={24} wrap='wrap'>
        {CAST.map(p => (
          <AgentAvatar
            key={p.id}
            data-testid={`agent-avatar-invite-${p.id}`}
            agent={p.id}
            seed={p.id}
            size={72}
            state='invite'
            live
            cueRef={cue}
          />
        ))}
      </HStack>
      <Button ref={cue} data-testid='agent-avatar-invite-setup' size='small'>
        Set up
      </Button>
    </VStack>
  );
};
```

### Activation

Activate: from Not set up the ghost lands, the color fills from the floor and the eyes power on (1.15 s).

```tsx
import { useState } from 'react';
import { AgentAvatar, type AgentAvatarState } from '@wallarm-org/design-system/AgentAvatar';
import { Button } from '@wallarm-org/design-system/Button';
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
import { CAST } from '../../lib/agent-characters/data.gen';

export const Activation = () => {
  const [state, setState] = useState<AgentAvatarState>('box');
  const toggle = () => setState(state === 'box' ? 'idle' : 'box');
  return (
    <VStack gap={16} align='center'>
      <HStack gap={24} wrap='wrap'>
        {CAST.map(p => (
          <AgentAvatar
            key={p.id}
            data-testid={`agent-avatar-activation-${p.id}`}
            agent={p.id}
            seed={p.id}
            size={72}
            live
            state={state}
          />
        ))}
      </HStack>
      <Button data-testid='agent-avatar-activation-toggle' size='small' onClick={toggle}>
        {state === 'box' ? 'Activate' : 'Reset'}
      </Button>
    </VStack>
  );
};
```

### Coverage

Cover all applications: the gray crown fills to the top in 480 ms and the agent plays Done. Hover or focus on the
button raises the line first.

```tsx
import { createRef, useRef, useState } from 'react';
import { AgentAvatar, type AgentAvatarHandle } from '@wallarm-org/design-system/AgentAvatar';
import { Button } from '@wallarm-org/design-system/Button';
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
import { CAST } from '../../lib/agent-characters/data.gen';

export const Coverage = () => {
  const [handles] = useState(() => CAST.map(() => createRef<AgentAvatarHandle>()));
  const cue = useRef<HTMLButtonElement>(null);
  const [coverage, setCoverage] = useState<'full' | 'partial'>('partial');
  const coverAll = () => handles.forEach(h => h.current?.coverAll());
  const onBeatEnd = () => setCoverage('full');
  const reset = () => setCoverage('partial');
  return (
    <VStack gap={16} align='center'>
      <HStack gap={24} wrap='wrap'>
        {CAST.map((p, i) => (
          <AgentAvatar
            key={p.id}
            data-testid={`agent-avatar-coverage-${p.id}`}
            agent={p.id}
            seed={p.id}
            size={72}
            live
            hasApplications
            coverage={coverage}
            handleRef={handles[i]}
            cueRef={cue}
            onBeatEnd={onBeatEnd}
          />
        ))}
      </HStack>
      <HStack gap={8}>
        <Button ref={cue} data-testid='agent-avatar-coverage-all' size='small' onClick={coverAll}>
          Cover all applications
        </Button>
        <Button
          data-testid='agent-avatar-coverage-reset'
          variant='outline'
          size='small'
          onClick={reset}
        >
          Reset
        </Button>
      </HStack>
    </VStack>
  );
};
```

### Many on screen

Fifteen live agents at 120 px, as on a full team page, with the engine's frame rate and JavaScript per frame.

```tsx
import { AgentAvatar, AgentAvatarGroup } from '@wallarm-org/design-system/AgentAvatar';
import { VStack } from '@wallarm-org/design-system/Stack';
import { FrameMeter } from './stories/FrameMeter';

export const ManyOnScreen = () => (
  <VStack gap={16}>
    <FrameMeter />
    <AgentAvatarGroup>
      <div className='grid grid-cols-5 gap-16'>
        {TEAM.slice(0, 15).map(m => (
          <AgentAvatar
            key={m.id}
            data-testid={`agent-avatar-many-${m.id}`}
            look={m.look}
            seed={m.id}
            size={120}
            live
          />
        ))}
      </div>
    </AgentAvatarGroup>
  </VStack>
);
```

### Reduced motion

With motion off (the user's setting, or reduced motion in the system) every live agent shows its static frame.

```tsx
import { useEffect, useState } from 'react';
import { AgentAvatar, setAgentMotion, useAgentMotion } from '@wallarm-org/design-system/AgentAvatar';
import { Button } from '@wallarm-org/design-system/Button';
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
import { CAST } from '../../lib/agent-characters/data.gen';

export const ReducedMotion = () => {
  const motion = useAgentMotion();
  const [off, setOff] = useState(false);
  useEffect(() => {
    setAgentMotion(!off);
    return () => setAgentMotion(true);
  }, [off]);
  const toggle = () => setOff(!off);
  return (
    <VStack gap={16} align='center'>
      <HStack gap={24} wrap='wrap'>
        {CAST.map((p, i) => (
          <AgentAvatar
            key={p.id}
            data-testid={`agent-avatar-motion-${p.id}`}
            agent={p.id}
            seed={p.id}
            size={72}
            state={LIVE_STATES[i % 4]}
            live
          />
        ))}
      </HStack>
      <Button
        data-testid='agent-avatar-motion-toggle'
        variant='outline'
        size='small'
        onClick={toggle}
      >
        {off ? 'Turn motion on' : 'Turn motion off'}
      </Button>
    </VStack>
  );
};
```

## Props

| Prop            | Type                                             | Default | Description                                                                                                                                                                                                                                                                                             |
| --------------- | ------------------------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id              | `string \| undefined`                            |         |                                                                                                                                                                                                                                                                                                         |
| onChange        | `ChangeEventHandler<T, Element> \| undefined`    |         |                                                                                                                                                                                                                                                                                                         |
| type            | `string \| undefined`                            |         |                                                                                                                                                                                                                                                                                                         |
| name            | `string \| undefined`                            |         |                                                                                                                                                                                                                                                                                                         |
| height          | `string \| number \| undefined`                  |         |                                                                                                                                                                                                                                                                                                         |
| max             | `string \| number \| undefined`                  |         |                                                                                                                                                                                                                                                                                                         |
| min             | `string \| number \| undefined`                  |         |                                                                                                                                                                                                                                                                                                         |
| target          | `string \| undefined`                            |         |                                                                                                                                                                                                                                                                                                         |
| width           | `string \| number \| undefined`                  |         |                                                                                                                                                                                                                                                                                                         |
| href            | `string \| undefined`                            |         |                                                                                                                                                                                                                                                                                                         |
| seed \*         | `string \| number \| undefined`                  |         |                                                                                                                                                                                                                                                                                                         |
| agent           | `AgentCharacterId`                               |         |                                                                                                                                                                                                                                                                                                         |
| look            | `undefined`                                      |         |                                                                                                                                                                                                                                                                                                         |
| size \*         | `AgentAvatarSize`                                |         | Set per place (see PLACES): 40 Overview rows, 48 headers and toasts, 56 beside people and in the hover card, 72 cards and the drawer, 120 the empty chat, 128 the product's Agent team card and drawer header.                                                                                          |
| state           | `AgentAvatarState \| undefined`                  | `idle`  |                                                                                                                                                                                                                                                                                                         |
| hasApplications | `boolean \| undefined`                           | `false` | The agent's template has applications (`applications_scoped`): only then can it show Partial coverage.                                                                                                                                                                                                  |
| coverage        | `"full" \| "partial" \| undefined`               | `full`  | `partial` keeps the top of the head in grey felt, in every state but Deactivated.                                                                                                                                                                                                                       |
| shadow          | `boolean \| undefined`                           | `false` | The contact shadow: the drawer header, the empty chat and 96 px and up (D1).                                                                                                                                                                                                                            |
| align           | `"box" \| "drawing" \| undefined`                | `box`   | `drawing` centres the character's visible drawing, not its box, on the row: beside a name and role, where a short character (Sift, Tune, Lens) would hang below the text. Moves the drawing only; the box keeps its size and place. Presets only (a custom look stays where its box is). Default `box`. |
| label           | `string \| undefined`                            |         | Set when the character stands alone; leave unset next to the agent's visible name (decorative).                                                                                                                                                                                                         |
| live            | `boolean \| undefined`                           | `false` | Animated, set per place (40 Overview rows, 56 the hover card, 72 cards and the drawer, 120 the empty chat). Static under reduced motion or when motion is switched off (`setAgentMotion`).                                                                                                              |
| handleRef       | `Ref<AgentAvatarHandle> \| undefined`            |         | Beats and Cover all: `play('hello' \| 'done')`, `coverAll()`, `cueHover(on)`.                                                                                                                                                                                                                           |
| onBeatEnd       | `((beat: AgentAvatarBeat) => void) \| undefined` |         | After Hello or Done has played in full; the character shows `state` again.                                                                                                                                                                                                                              |
| cueRef          | `RefObject<HTMLElement \| null> \| undefined`    |         | The Set up (or Cover all) control: Inviting glances at it; hover and focus on it are followed.                                                                                                                                                                                                          |
