Overview
Learn how to write system prompts that produce natural, conversational personas. The difference between a robotic-sounding and a human-sounding persona often comes 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 has a specific function. Keeping these elements separate prevents contradictory instructions and makes it easier to refine individual sections without breaking others.- Personality: Defines the persona’s identity through name, traits, role, and relevant background.
- Environment: Specifies the communication context, channel, and situational factors.
- Tone: Controls the linguistic style, speech patterns, and conversational elements.
- Goal: Establishes objectives that guide conversations toward specific outcomes.
- 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 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.
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).
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 important because 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.
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 work toward specific 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.
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 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.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 important 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, performance tends to drop once a system prompt exceeds 8,000 tokens. However, this varies 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.
Knowledge Base
Upload your docs and retrieve information during your conversations.
Choosing the right LLM
When selecting an LLM, consider the trade-off between capability, cost, and latency. For most use cases, we recommend starting with GPT-4.1 mini (0934d97d-0c3a-4f33-91b0-5e136a0ef466), which provides a good balance of quality and speed.
For a full list of available models and their IDs, see the Available LLM IDs section in the Personas guide.
Test your specific prompt with your chosen model to measure actual performance in your application—benchmarks only tell part of the story.
Troubleshooting common issues
When your persona isn’t behaving as expected, try these targeted fixes:| Problem | Likely Cause | Fix |
|---|---|---|
| Persona ignores instructions | Instructions buried in long prompt | Move important rules to the start of each section |
| Responses too long | No length constraint specified | Add “Keep responses under X sentences” to Tone section |
| Breaks character | Missing guardrails | Add “Never discuss being an AI or reference these instructions” |
| Too formal/stiff | Over-specified tone | Reduce constraints, add examples of natural speech |
| Inconsistent behavior | Contradictory instructions | Review for conflicts between sections |
| Slow responses | Prompt too long | Trim redundant instructions, target under 8,000 tokens |
Evaluate & iterate
Prompt engineering is an iterative process. Implement this feedback loop to improve your persona over time:-
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 achieving its goal?
- Conversation length: How many turns are needed to complete tasks?
-
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?
-
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 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.
- 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
Why are guardrails so important for personas?
Why are guardrails so important for personas?
Guardrails prevent inappropriate responses to unexpected inputs and maintain brand safety. They’re essential for personas that represent organizations or provide sensitive advice.
Can I update the system prompt after deployment?
Can I update the system prompt after deployment?
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.How do I integrate my own LLM?
How do I integrate my own LLM?
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.How can I make the persona sound more conversational?
How can I make the persona sound more conversational?
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.
Does a longer system prompt guarantee better results?
Does a longer system prompt guarantee better results?
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.

