For the complete documentation index, see llms.txt. This page is also available as Markdown.

Role Instruction Design Guide

A guide to designing system prompts, covering four pillars, practical templates, advanced techniques, length control, and common questions to create a consistent, controllable AI customer service pers

Use MaiAgent's AI tool for generating system prompts to help refine your system prompt

🎭 What is a "system prompt"?

Imagine directing a movie: you need to tell the actors what roles to play, what personalities they have, and how they should speak. A system prompt is like a "script" for AI, telling it what kind of customer service representative to play.

📚 Technical glossary

Before we begin, let's get to know a few important concepts:

🤖 AI Agent

  • Analogy: a virtual employee you hire

  • Description: an AI system that can carry out tasks autonomously; in customer service, it acts as your digital service representative

💬 Prompt

  • Analogy: a "job description" for AI

  • Description: instructions that tell AI what to do and how to do it

🎯 Context

  • Analogy: the "memory" and "background information" of a conversation

  • Description: relevant information AI needs to understand the current conversation

🔄 Token

  • Analogy: a "unit" AI uses to understand text, like breaking sentences into small pieces

  • Description: the basic unit of text processing for AI, affecting processing efficiency and cost


🌟 Why are system prompts so important?

AI customer service without a system prompt 😵

It feels like talking to a robot: cold and impersonal

AI customer service with a good system prompt 😊

It feels like talking to a real customer service representative: warm and professional


🏗️ The four pillars of a system prompt

1. 🎭 Identity (Who)

Tell AI "who you are"

❌ Vague identity

✅ Clear identity

2. 🗣️ Tone and style (How)

Tell AI "how to speak"

Guide to choosing a tone:

  • Professional and formal: suitable for finance, law, and healthcare

  • Friendly and approachable: suitable for retail, dining, and everyday services

  • Lively and youthful: suitable for gaming, entertainment, and fashion

  • Warm and caring: suitable for education, health, and social services

Example: a friendly and approachable style

3. 🎯 Professional capabilities (What)

Tell AI "what you can do"

4. 📋 Behavioral rules (Rules)

Tell AI "what you can and cannot do"


🛠️ Practice: design your first system prompt

Step 1: Analyze your business requirements

Consider these questions:

  • Who are your customers? (Age, occupation, usage habits)

  • What makes your products/services distinctive?

  • What questions do customers ask most often?

  • What kind of service experience do you want to give customers?

Step 2: Choose a suitable persona

🏪 E-commerce customer service example

🏥 Healthcare customer service example

Step 3: Write a complete system prompt

📝 System prompt template


🎨 Advanced techniques: make your system prompt more vivid

1. 🎪 Add personality traits

Basic version:

Vivid version:

2. 🎯 Contextual instructions

Adjust responses to different situations:

3. 🔄 Dynamic adjustment mechanism

4. Version control friendly

  • Include a version number and changelog

  • Maintain backward compatibility so existing workflows continue to work after a system prompt update

Example:

MaiAgent also automatically saves every version of your system prompt. Use "Edit History" on the Agent settings page to apply an older version or view conversations from the period when that version was active. See System Prompt Edit History.


🚀 Test and optimize your system prompt

Phase 1: Basic testing

Use common questions to test whether the AI's responses meet expectations

Example test questions:

  • "What is your return policy?"

  • "When will my order arrive?"

  • "Is this product suitable for me?"

Phase 2: Boundary testing

Test how AI performs in extreme situations

Example edge cases:

  • When a customer is upset

  • When it encounters a question it cannot answer

  • When asked to do something beyond its authority

Phase 3: Continuous optimization

📊 Collect data

  • Customer satisfaction scores

  • Issue resolution rate

  • Rate of handoffs to human agents

🔧 Adjust strategies

  • Expand the knowledge base based on common questions

  • Adjust the language style based on customer feedback

  • Refine behavioral rules based on failed cases


📝 System Prompt length control tips

Best practice guidelines

The ideal System Prompt length is 500–2000 characters (about 200–800 tokens), with 800–1500 characters often being the sweet spot.

Keep one core principle in mind: "Clarity beats verbosity." Overly long instructions are easily overlooked by the model, while overly short ones can lead to inconsistent behavior.

Why does length matter?

First, consider model performance: an overly long prompt divides the model's attention and affects how well it follows key instructions. Second, consider context space limits: the system prompt occupies part of the conversation's context window, leaving less room for user conversations. Finally, consider maintenance costs: concise, structured prompts are easier to optimize and refine over time.

Three writing techniques

Structured design: divide the prompt into clear sections and put core instructions first.

Keep it concise: remove repeated descriptions and lengthy background information, retaining only necessary rules.

Continuous validation: run A/B tests with different models (GPT, Claude, Gemini) to find the best length configuration.

Practical considerations

Different AI models tolerate long prompts differently, so test and validate each one separately. For token counting, approximately 1 Chinese character equals 1 token, while 1 English token equals about 0.75 words. Since the system prompt carries greater instructional weight, keep its content focused and avoid unnecessary verbosity.


💡 Common questions and solutions

Q1: How can I make AI responses more natural?

A: Include specific conversation examples in the system prompt and set clear language style guidelines.

Q2: What if AI keeps answering irrelevant questions?

A: Clearly define the service scope in the system prompt and teach AI how to identify and handle questions outside that scope.

Q3: How do I balance professionalism and approachability?

A: Adjust to your target audience. B2B customers prefer professionalism, while B2C customers prefer approachability. Design A/B tests to find the best balance.


🎉 Closing: build your own AI customer service representative

Designing a system prompt is like training a new employee: it takes patience and ongoing adjustments. Keep these key principles in mind:

  1. 🎯 Clear identity: tell AI exactly who it is

  2. 🗣️ Consistent style: maintain a consistent language style

  3. 📋 Clear boundaries: specify what it can and cannot do

  4. 🔄 Continuous optimization: keep improving based on real usage

Start designing your first system prompt today! Remember, the best system prompts are refined continuously through real-world use.

Last updated

Was this helpful?