DEV Community

Cover image for Keep agent avatars distinct as your team grows
Felix Koba
Felix Koba

Posted on

Keep agent avatars distinct as your team grows

A deterministic generator guarantees one thing: the same seed gets the same avatar.

An identity set has a harder requirement: every avatar must also be easy to distinguish from the rest.

Generate identities independently and collisions are still possible. Two agents may have different hashes but end up with the same signature, similar shapes, or nearly identical palettes.

The output is deterministic. The interface is still ambiguous.

The unit of allocation should be the set, not the individual avatar.

That is what createIdentitySet() does:

import { createIdentitySet } from "agent-avatars";

const team = createIdentitySet(
  ["research", "support", "billing"],
  {
    ensureUnique: true,
    minimumShapeDistance: 4,
    minimumPaletteDistance: 20,
    distanceMode: "either",
  }
);
Enter fullscreen mode Exit fullscreen mode

The set is built as a whole.

When a new identity is added, it has to remain clearly different from the identities already in the group. That difference can come from the shape, the palette, or both, depending on how strict the set needs to be.

The set can also grow without reshuffling everyone! Existing agents keep their identities, while each new one is placed around what is already there.

And if the requested set cannot be built, the function fails. It does not quietly lower the requirements just to return something.

That is the real difference: deterministic generation keeps one avatar stable. Identity-set allocation keeps the whole group readable.

createIdentitySet() is available in agent-avatars 1.0.1.

Live demo ยท GitHub ยท npm

Top comments (0)