Skip to content
TuffTasks, docs and chat for teams and AI agents

Tools & Approvals

Agent Persona

Set up an agent in one card — name, a cycling avatar, formal–casual and brief–detailed sliders, a voice and capped tool chips, with a live greeting that rewrites as you go.

1 variantMIT

Preview

New agent

Draft

ToneFriendly
FormalCasual
LengthBalanced
BriefDetailed
VoiceEven · mid · precise
Tools2 of 5

Preview

Live

Unnamed

Hi, I'm your agent! I can sort out your calendar, draft emails and dig up answers. What are we working on today?

FriendlyBalanced

Voice

Slate

Can use

  • Web search
  • Calendar

Installation

Copies the component into components/ui and installs its dependencies and theme tokens.

pnpm dlx shadcn@latest add https://tuffui.com/r/agent-persona.json

Usage

Pass your own data and wire the callbacks to your agent runtime.

import { CalendarBlank, EnvelopeSimple, Globe } from "@phosphor-icons/react";
import { AgentPersona } from "@/components/ui/agent-persona";

export function NewAgentCard({ onCreated }: Props) {
  return (
    <AgentPersona
      voices={[
        { id: "ember", label: "Ember", hint: "Warm · low · unhurried" },
        { id: "slate", label: "Slate", hint: "Even · mid · precise" },
      ]}
      tools={[
        { id: "web", label: "Web search", icon: Globe },
        { id: "calendar", label: "Calendar", icon: CalendarBlank },
        { id: "email", label: "Email", icon: EnvelopeSimple },
      ]}
      maxTools={2}
      defaultValue={{ tone: 70, length: 30, toolIds: ["calendar"] }}
      onSave={(persona) =>
        createAgent({
          name: persona.name,
          avatar: persona.lookId,
          // 0 formal … 100 casual, 0 brief … 100 detailed.
          style: { tone: persona.tone, length: persona.length },
          voice: persona.voiceId,
          tools: persona.toolIds,
        }).then(onCreated)
      }
    />
  );
}

Props

PropTypeDefaultDescription
voices*PersonaVoice[]—Voices in the segmented picker. The selected voice's `hint` shows beside the label.
tools*PersonaTool[]—Tools as icon chips. Each toggles on or off, up to `maxTools`.
maxToolsnumber5Most tools on at once. At the cap the other chips dim and a note says to turn one off first.
valueAgentPersonaValue—Controlled persona: name, look, tone, length, voice and tools.
defaultValuePartial<AgentPersonaValue>—Starting persona when uncontrolled. Unset parts default to an empty name, the first look and voice, both sliders in the middle and no tools.
onValueChange(value: AgentPersonaValue) => void—Called on every edit: a keystroke, a look, a slider step, a voice, a tool.
looksPersonaLook[]PERSONA_LOOKSAvatar looks the avatar button cycles through (Shift+click goes back): a glyph — orb, spark, hex, cube, ring or petal — on a tint.
greetingsPersonaGreetingsPERSONA_GREETINGSThe preview's greeting for each tone bucket (formal, friendly, casual) × length bucket (brief, balanced, detailed). `{name}` becomes the agent's name. A new bucket crossfades in with a blur.
onSave(value: AgentPersonaValue) => void—Shows the primary "Save agent" button. Disabled while the name is empty.
onCancel() => void—Shows a quiet "Cancel" button.
iconIconRobotPhosphor icon in the header tile.
titleReactNode"New agent"Header title.
subtitleReactNode"Draft · {name}"Secondary line under the title.
classNamestring—Extra classes for the root element.
type AgentPersonaValue = {
  name: string;      // "Mira"
  lookId: string;    // a PersonaLook id
  tone: number;      // 0 formal … 100 casual
  length: number;    // 0 brief … 100 detailed
  voiceId: string;
  toolIds: string[];
};

type PersonaVoice = { id: string; label: string; hint?: string };
type PersonaTool = { id: string; label: string; icon: Icon };

type PersonaShape = "orb" | "spark" | "hex" | "cube" | "ring" | "petal";
type PersonaLook = { id: string; shape: PersonaShape; tint: string }; // tint: "#0a84ff"

type PersonaGreetings = Record<
  "formal" | "friendly" | "casual",
  Record<"brief" | "balanced" | "detailed", string>
>;

// Also exported: personaAvatarSrc(look) — the look as an SVG data URL for
// <Avatar src> wherever the agent appears — plus toneBucket(v), lengthBucket(v),
// PERSONA_LOOKS and PERSONA_GREETINGS.