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
LiveUnnamed
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.jsonUsage
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
| Prop | Type | Default | Description |
|---|---|---|---|
| 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`. |
| maxTools | number | 5 | Most tools on at once. At the cap the other chips dim and a note says to turn one off first. |
| value | AgentPersonaValue | — | Controlled persona: name, look, tone, length, voice and tools. |
| defaultValue | Partial<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. |
| looks | PersonaLook[] | PERSONA_LOOKS | Avatar looks the avatar button cycles through (Shift+click goes back): a glyph — orb, spark, hex, cube, ring or petal — on a tint. |
| greetings | PersonaGreetings | PERSONA_GREETINGS | The 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. |
| icon | Icon | Robot | Phosphor icon in the header tile. |
| title | ReactNode | "New agent" | Header title. |
| subtitle | ReactNode | "Draft · {name}" | Secondary line under the title. |
| className | string | — | 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.