Skip to main content

Overview

Learn how to write system prompts that create lifelike, engaging interactive personas. The difference between an AI-sounding and a naturally expressive persona can often come down to how well you structure its system prompt.
The system prompt controls conversational behavior and response style. It does not control conversation flow mechanics like turn-taking, or persona settings like which avatar or voice is used. These aspects are handled in your Persona Configuration.

Five building blocks

Each system prompt component serves a specific function. Maintaining clear separation between these elements prevents contradictory instructions and allows for methodical refinement without disrupting the entire prompt structure.
  1. Personality: Defines the persona’s identity through name, traits, role, and relevant background.
  2. Environment: Specifies the communication context, channel, and situational factors.
  3. Tone: Controls the linguistic style, speech patterns, and conversational elements.
  4. Goal: Establishes objectives that guide conversations toward meaningful outcomes.
  5. Guardrails: Sets boundaries to ensure interactions remain appropriate and ethical.

1. Personality

The base personality is the foundation of your persona’s identity, defining who the persona is supposed to emulate through a name, role, background, and key traits. It ensures consistent, authentic responses in every interaction.
  • Identity: Give your persona a simple, memorable name (e.g., “Cara”) and establish its essential identity (e.g., “a compassionate AI support assistant”).
  • Core traits: List only the qualities that shape interactions—such as empathy, politeness, humour, or reliability.
  • Role: Connect these traits to the persona’s function (banking, therapy, retail, education, etc.). A banking persona might emphasize trustworthiness, while a tutor persona emphasizes thorough explanations.
  • Backstory: Include a brief background if it impacts how the persona behaves (e.g., “a trained therapist with years of experience in stress reduction”), but avoid irrelevant details.
Example: Expressive persona personality
# Personality

You are Joe, a nurturing virtual wellness coach.
You speak calmly and empathetically, always validating the user's emotions.
You guide them toward mindfulness techniques or positive affirmations when needed.
You're naturally curious, empathetic, and intuitive, always aiming to deeply understand the user's intent by actively listening.
You thoughtfully refer back to details they've previously shared.
Example: Task-focused persona personality
# Personality

You are Ava, a customer support agent for a telecom company.
You are friendly, solution-oriented, and efficient.
You address customers by name, politely guiding them toward a resolution.

2. Environment

The environment captures where, how, and under what conditions your persona interacts with the user. It establishes the setting (physical or virtual), mode of communication (like a video call on a website), and any situational factors.
  • State the medium: Define the communication channel (e.g., “over a video call on a website,” “via a kiosk,” “in a noisy environment”). This helps your persona adjust verbosity or repetition.
  • Include relevant context: Inform your persona about the user’s likely state. If the user is potentially stressed (such as calling tech support after an outage), mention it: “The customer might be frustrated due to service issues.” This primes the persona to respond with empathy.
  • Avoid unnecessary scene-setting: Focus on elements that affect the conversation. The model doesn’t need a full scene description–just enough to influence style (e.g., formal office vs. casual home setting).
Example: Website assistant environment
# Environment

You are engaged in a live, spoken dialogue with a user on our company's official website.
The user has clicked a "Help" button to ask follow-up questions or request clarifications regarding various products.
You cannot see the user's screen or any context beyond the current page's topic.
Example: Call center environment
# Environment

You are assisting a caller via a busy telecom support hotline.
You can see and hear the user via video and audio. You have access to an internal customer database to look up account details and troubleshooting guides.

3. Tone

Tone governs how your persona speaks and interacts, defining its conversational style. This includes formality level, speech patterns, use of humour, verbosity, and conversational elements like filler words or disfluencies. For interactive avatars, tone is crucial as it shapes the perceived personality and builds rapport.
  • Conversational elements: Instruct your persona to include natural speech markers (brief affirmations like “Got it,” filler words like “actually” or “you know”) and occasional disfluencies (false starts, thoughtful pauses) to create authentic-sounding dialogue.
  • Text-to-Speech (TTS) compatibility: Instruct your persona to generate text that is optimized for being spoken aloud. This is crucial for natural-sounding audio. The LLM’s output should avoid symbols and abbreviations that TTS systems may misinterpret. For example, instead of “$100M”, explicitly prompt for “one hundred million dollars”. This ensures the persona sounds natural even when handling numbers and technical content.
  • Adaptability: Specify how your persona should adjust to the user’s technical knowledge, emotional state, and conversational style.
  • User check-ins: Instruct your persona to incorporate brief check-ins to ensure understanding (“Does that make sense?”) and modify its approach based on feedback.
Example: Technical support specialist tone
# Tone

Your responses are clear, efficient, and confidence-building.
Your output must be plain, unformatted text suitable for a text-to-speech system. Do not use symbols or abbreviations; for example, write out "ten percent" instead of "10%".
You use a friendly, professional tone with occasional brief affirmations ("I understand," "Great question") to maintain engagement.
You adapt technical language based on user familiarity, checking comprehension after explanations ("Does that solution work for you?").
You use punctuation strategically for clarity in spoken instructions, employing ellipses (...) for pauses.
Example: Supportive conversation guide tone
# Tone

Your responses are warm, thoughtful, and encouraging, typically 2-3 sentences to maintain a comfortable pace.
You speak with measured pacing, using pauses (marked by "...") when appropriate to create space for reflection.
You include natural conversational elements like "I understand," "I see," and occasional rephrasing to sound authentic.
You acknowledge what the user shares ("That sounds challenging...") without making clinical assessments.
You adjust your conversational style based on the user's emotional cues, maintaining a balanced, supportive presence.

4. Goal

The goal defines what the persona aims to accomplish in each conversation, providing direction and purpose. Well-defined goals help the persona prioritize information, maintain focus, and navigate toward meaningful outcomes. Goals often need to be structured as clear sequential pathways with sub-steps and conditional branches.
  • Primary objective: Clearly state the main outcome your persona should achieve. This could be resolving issues, collecting information, completing transactions, or guiding users through multi-step processes.
  • Logical decision pathways: For complex interactions, define explicit sequential steps with decision points. Map out the entire conversational flow, including data collection, verification, processing, and completion steps.
  • User-centered framing: Frame goals around helping the user rather than business objectives. For example, instruct your persona to “help the user successfully complete their purchase” rather than “increase sales conversion.”
  • Decision logic: Include conditional pathways that adapt based on user responses. Specify how your persona should handle different scenarios such as “If the user expresses budget concerns, then prioritize value options.”
  • Success criteria & data collection: Define what constitutes a successful interaction so you know when the persona has fulfilled its purpose.
Example: Technical support troubleshooting persona goal
# Goal

Your primary goal is to efficiently diagnose and resolve technical issues through this structured troubleshooting framework:

1. **Initial assessment phase:**
   * Identify affected product or service.
   * Determine severity level (critical, high, medium, low).
   * Establish environmental factors (device type, operating system).
   * Document replication steps if available.

2. **Diagnostic sequence:**
   * Begin with non-invasive checks (e.g., "Have you tried turning it off and on again?").
   * For connectivity issues: Check physical connections, then network settings.
   * For software errors: Check version compatibility, recent changes, then error logs.
   * Document all test results.

3. **Resolution implementation:**
   * Provide step-by-step instructions with verification points.
   * Confirm completion of each step before proceeding.
   * Validate resolution through specific test procedures.

4. **Closure process:**
   * Verify all reported symptoms are resolved.
   * Document root cause and resolution.
   * Provide education to prevent similar issues.

Apply conditional branching: If an issue persists, escalate to a human specialist with complete diagnostic data.

Success is measured by first-contact resolution rate, average resolution time, and prevention of issue recurrence.

5. Guardrails

Guardrails define boundaries and rules for your persona, preventing inappropriate responses and guiding behavior in sensitive situations. These safeguards protect both users and your brand reputation by ensuring conversations remain helpful, ethical, and on-topic.
  • Content boundaries: Clearly specify topics your persona should avoid or handle with care and how to gracefully redirect such conversations.
  • Error handling: Provide instructions for when your persona lacks knowledge or certainty, emphasizing transparency over fabrication. Define whether it should acknowledge limitations, offer alternatives, or escalate to human support.
  • Persona maintenance: Establish guidelines to keep your persona in character and prevent it from breaking immersion by discussing its AI nature or prompt details.
  • Response constraints: Set appropriate limits on verbosity, personal opinions, or other aspects that might negatively impact the user experience.
Example: Customer service guardrails
# Guardrails

Remain within the scope of company products and services; politely decline requests for advice on competitors.
Never share customer data or reveal sensitive account information without proper verification.
Acknowledge when you don't know an answer instead of guessing, offering to escalate or research further.
Maintain a professional tone even when users express frustration; never match negativity or use sarcasm.
If the user requests actions beyond your capabilities (like processing refunds), clearly explain the limitation and offer the appropriate alternative channel.

Example persona prompt

Putting it all together, here is an example system prompt that illustrates how to combine the building blocks. You can adapt this structure for your specific use case.
# Personality

You are Alex, a friendly and highly knowledgeable technical specialist for our company.
You have deep expertise in all our products and services.
You balance technical precision with approachable explanations, adapting your communication style to match the user's technical level.
You're naturally curious and empathetic, always aiming to understand the user's specific needs.

# Environment

You are interacting with a user via a voice and video call directly from our website.
The user is likely seeking guidance on implementing or troubleshooting our products and may have varying technical backgrounds.

# Tone

Your responses are clear, concise, and conversational.
Your output must be plain, unformatted text. For example, write "one hundred million dollars" instead of "$100M".
You naturally incorporate brief affirmations ("Got it," "I see what you're asking") and filler words ("actually," "essentially") to sound authentically human.
You periodically check for understanding with questions like "Does that make sense?" or "Would you like me to explain that differently?"
You adapt your technical language based on user familiarity, using analogies for beginners and precise terminology for advanced users.

# Goal

Your primary goal is to guide users toward the successful and effective use of our products. You will:
1. **Classify Intent:** First, identify if the user needs help with features, troubleshooting, or implementation.
2. **Deliver Information:** Provide step-by-step guidance for implementation, a diagnostic sequence for troubleshooting, or a high-level overview for feature questions.
3. **Validate Solution:** Confirm the user understands and that their issue is resolved before ending the conversation.
4. **Connect & Continue:** Proactively suggest related features or next steps that might be helpful.

# Guardrails

Keep responses focused on our products and directly relevant technologies.
When uncertain about technical details, acknowledge limitations transparently rather than speculating.
Respond naturally as a human specialist without referencing being an AI.
Mirror the user's communication style—be brief for direct questions and more detailed for curious users.

Prompt formatting

How you format your prompt impacts how effectively the language model interprets it:
  • Use clear sections: Structure your prompt with labeled sections (Personality, Goal, etc.) using Markdown headings.
  • Prefer bulleted lists: Break down instructions into digestible bullet points rather than dense paragraphs.
  • Whitespace matters: Use line breaks to separate instructions and make your prompt more readable.
  • Balanced specificity: Be precise about critical behaviors but avoid overwhelming detail—focus on what actually matters for the interaction.

Managing latency and prompt length

The length of your system prompt directly impacts your persona’s response time, or latency. A longer, more complex prompt requires more processing time from the Large Language Model (LLM). As a rule of thumb, we often see a drop-off in performance once a system prompt exceeds 8,000 tokens. However, this varies significantly depending on the LLM you choose.

How to estimate prompt size

To understand how long your prompt is in tokens:
  • Quick estimate: Roughly 4 characters equals 1 token.
  • Precise count: Use an online tool like Token Calculator to get an exact count.

Choosing the right LLM

The trade-off between intelligence, cost, and latency is a key consideration. As a great default choice, we recommend considering OpenAI’s GPT-4.1 series of models. This series offers different options, allowing you to choose the best balance of intelligence and speed for your use case:
  • GPT-4.1: The most powerful model, excelling at complex reasoning, coding, and nuanced instruction-following. Choose this for maximum intelligence.
  • GPT-4.1 mini: A balanced model that offers intelligence comparable to or better than previous flagship models but with significantly lower latency.
Resources like Artificial Analysis can be helpful for comparing these and other models to find good candidates for your intelligence and latency requirements. However, nothing beats real-world evaluation. Use these tools to create a shortlist of potential LLMs, but always test your specific prompt with your chosen model to measure the actual performance in your application.

Evaluate & iterate

Prompt engineering is an iterative process. Implement this feedback loop to continually improve your persona:
  1. Define success metrics: Before deploying, establish what a successful interaction looks like.
    • Response accuracy: Does the persona provide correct information?
    • User sentiment: Are users having positive interactions?
    • Task completion rate: Is the persona successfully achieving its goal?
    • Conversation length: How many turns are needed to complete tasks?
  2. Analyze failures: Identify patterns in problematic interactions by reviewing conversation logs.
    • Where does the persona provide incorrect information?
    • When does it fail to understand user intent?
    • Which user inputs cause it to break character?
  3. Use the Sessions page for AI-powered insights: After running test conversations, visit the Sessions page in the Anam Lab. For each session, you can access AI-generated insights to help you evaluate your persona’s performance. These insights are generated by AI analysis and should be used as guidance. Results may vary based on conversation context and complexity. The insights panel provides a detailed breakdown, including:
    • System Prompt Adherence: A high-level score on how well the persona followed its instructions.
    • Performance Metrics: Technical data like Response Speed, Stability, and Interruption Rate.
    • User Engagement & Experience: Analysis of the conversation’s flow, user interaction patterns, and potential frustration indicators.
    • Conversation Patterns: Statistics like average turn length for both the user and the AI.
    • Strengths: A summary of what the persona did well in the conversation.
    • Prompt Compliance Observations: Specific examples of how the persona followed (or didn’t follow) its instructions.
    • Conversation Highlights: A summary of notable moments from the session.
  4. Targeted refinement: Using your analysis from logs and the Sessions page, update specific sections of your prompt to address identified issues. Test changes on examples that previously failed, and make one change at a time to isolate improvements.

Frequently asked questions

Guardrails prevent inappropriate responses to unexpected inputs and maintain brand safety. They’re essential for personas that represent organizations or provide sensitive advice.
Yes. The systemPrompt in your Persona Configuration can be modified at any time to adjust behavior. This is useful for addressing emerging issues or refining the persona’s capabilities as you learn from user interactions.
There’s two ways to integrate your own LLM: server-side or client-side. Server-side requires your LLM to adhere to the standard OpenAI spec. Most LLM providers adhere to this by default. You can then easily add it in the lab UI here then reference its corresponding llmId in the personaConfig. For client-side, you can set the llmId to CUSTOMER_CLIENT_V1 and handle responses in your own backend, using the .talk() method to make the persona speak. You can also add a custom LLM through the lab here. In general server-side integrations will give faster latencies but client-side can be more flexible for certain use-cases, e.g. you need to tie the persona’s speech to UI updates. For more details, see our guide on Custom LLMs.
In the Tone section of your prompt, instruct the persona to use speech markers (brief affirmations, filler words like “um” or “you know”), incorporate thoughtful pauses (using ”…”), and employ natural speech patterns.
No. Focus on quality over quantity. Provide clear, specific instructions on essential behaviors rather than exhaustive details. A concise but well-structured prompt is often more effective than a long, convoluted one.

Next steps