Shape distance
Hamming distance across the complete 5 × 4 bitmap. The integer threshold ranges from 0 to 20.
Multi-agent identity
Allocate avatars together when operators must tell research, billing, security, and orchestration agents apart. Exact signature uniqueness is built in; optional distance rules add visible separation.
createIdentitySet() sorts identity work deterministically, assigns signatures, and returns both render descriptors and a manifest for later growth.
import { createIdentitySet } from "agent-avatars";
const team = createIdentitySet(
["research", "support", "billing"],
{
namespace: "my-product/agents",
ensureUnique: true,
minimumShapeDistance: 4,
minimumPaletteDistance: 20,
distanceMode: "either",
includeSvg: true,
}
);A signature prevents exact shape-and-palette duplicates. A visual-distance policy can additionally require different bitmap cells, different palette appearance, or both cues.
Hamming distance across the complete 5 × 4 bitmap. The integer threshold ranges from 0 to 20.
A versioned perceptual metric compares light and dark foreground/background pairs. The finite threshold ranges from 0 to 100.
either accepts one sufficiently strong cue. both requires both thresholds and is stricter for small sets.
Higher thresholds reduce feasible capacity. The allocator is deterministic and greedy; exhausting its attempt limit does not prove that no packing exists elsewhere.
Persist the returned manifest and pass it back when the roster grows. Existing agents keep their signatures while new identities are constrained by the stored policy.
const first = createIdentitySet(["research", "support"], policy);
saveManifest(first.manifest);
const expanded = createIdentitySet(
["research", "support", "billing"],
{ ...policy, manifest: loadManifest() }
);Treat the manifest as versioned application data. A stored policy must match the next request, and tampered assignments are validated before use.
The strict API throws when allocation is infeasible. Interactive interfaces can choose the fallback helper, inspect its adjustment, and explain the effective policy to the user.
import { createIdentitySetWithFallback } from "agent-avatars";
const team = createIdentitySetWithFallback(seeds, {
minimumShapeDistance: 8,
minimumPaletteDistance: 30,
distanceMode: "both",
manifest: previousManifest,
});
if (team.policyAdjustment) {
console.info(team.policyAdjustment);
}The fallback helper never weakens an existing manifest policy. For a new set, it performs a bounded deterministic relaxation and reports requested and applied values.
Validation happens before expensive work. Use the catalog stats and errors to set product limits that match your palettes and separation policy.
One call accepts at most 10,000 seeds, 10,000 manifest entries, and 256 custom palettes.
getCatalogStats().signatureStates reports shape-and-palette signature capacity, not guaranteed perceptual capacity under a distance policy.
The generator can build, inspect, copy, and download a manifest-backed identity set directly in the browser.