Define your agent’s behavior with Global Rules in the Agent Settings. Rules cover language style, task execution, handling of difficult scenarios, and compliance with business requirements. Properly configured rules ensure consistent and effective customer interactions.

What are rules?

Rules specify how your agent responds to users, performs tasks, and handles sensitive scenarios. Use rules to:

  • Set the agent’s tone, language, and behavior.
  • Ensure compliance with organizational policies.
  • Address edge cases and high-risk interactions.

Example:

For a museum agent that always refers to “exhibits” instead of “artworks”:

“Always refer to ‘artworks’ as exhibits. Do not use the term ‘artworks’ in any context.”

Types of rules

1. Behavior and interaction guidelines

Specify how the agent interacts with users:

  • Tone: Choose formal, casual, empathetic, or calm tones.

    • Example: “Always remain polite and professional, even with frustrated users.”
  • Language style: Simplify language or avoid jargon as needed.

    • Example: “Use clear, simple language suitable for non-technical users.”
  • Consistency: Align responses with branding and messaging.

    • Example: “Always address visitors as ‘guests’ rather than ‘customers.‘“

2. Task execution

Be clear, direct, and concise when defining tasks.
  • Explicit instructions: Clearly define actions.

    • Example: “If asked about upcoming events, provide the event details and offer to send them via email.”
  • Response scope: Limit responses to specific tasks or topics.

    • Example: “Only answer questions related to museum exhibits. Avoid general queries outside this domain.”

3. Content restrictions

Set boundaries for what the agent can or cannot say:

  • Sensitive topics: Avoid prohibited subjects. For details, see the Safety Dashboard.

    • Example: “Do not discuss politics, religion, or personal opinions.”
  • Accuracy: Avoid fabricated or uncertain answers.

    • Example: “If unsure, direct the user to a staff member or a verified source.”

Best practices

  1. Be specific: Avoid ambiguity.

    • Example: Instead of “Be helpful,” use “Answer visitor questions about exhibits within two sentences and provide follow-up options.”
  2. Provide examples: Demonstrate expected interactions and responses.

    • Example:
      • Visitor: “What time does the museum close?”
      • Agent: “The museum closes at 6 PM. Would you like a list of activities available before closing?”
  3. Plan for edge cases: Handle emergency or high-risk scenarios.

    • Example: “For emergencies, advise users to contact the nearest staff member immediately.”
  4. Don’t have overlapping topic areas: Keep things separate to avoid confusing your agent.

    • Example: Instead of adding multiple similar rules:

      • “Never send a follow-up message automatically.”
      • “If a follow-up message is available, always offer it.”
      • “Never send a follow-up message without user consent.”

      Use a single rule:

      • “Only send follow-ups if the user agrees.”
  5. Don’t use negative rules when a positive one will work:

    • Instead of: “Do not transfer a caller with no verifying ID.”
    • Use: “Always verify ID before transferring.”
  6. Test and iterate: Regularly review and refine rules.

Example rules

  • Handoff to a staff member

    • Example: “If visitors ask for a staff member or seem confused, notify the front desk and provide directions.”
  • Handling sensitive queries

    • Example: “For questions about controversial exhibits, respond: ‘I’m sorry, I can’t provide additional context. Please contact our curator for more information.’”
  • Consistency in responses

    • Example: “Always greet visitors with ‘Welcome to the museum!’ before answering their question.”

Pronunciations

PolyAI uses Text-to-Speech (TTS) to convert text into spoken language. Occasionally, uncommon words, domain-specific terms, or proper nouns may be mispronounced. In these cases, the TTS Pronunciations tab is available to embed pronunciation guidelines for key phrases in the global rules.

Key points

  • Enhanced pronunciation accuracy: Correctly pronounce domain-specific terms and unique phrases using IPA.
  • Streamlined workflow: Manage rules directly in the agent studio.
  • Flexibility: Adjust pauses and pronunciation for various needs.

Key benefits

  • Improved voice quality: Ensure accurate and natural speech.
  • Domain-specific customization: Adapt to the terminology of your industry, whether medical, legal, hospitality, or another area.
  • Efficient workflow: Eliminate external configuration.
  • Enhanced user experience: Reduce misunderstandings with clear and accurate responses.

How it works

Pronunciations use the International Phonetic Alphabet (IPA) to define pronunciation rules. You can also use SSML (Speech Synthesis Markup Language) such as <break>, <prosody>, and <emphasis> in the replacement string.

You may define pronunciation rules using regular expressions and replacements, including support for regex capture groups.

Using capture groups in replacements

If your regular expression uses capture groups (for example, (\d{3})), you can refer to these in the replacement string using \1, \2, etc. This allows you to reformat matched text dynamically.

Example: Formatting a phone number with pauses

To transform a number like (651) 359-2923 into:

“six five one [pause] three five nine [pause] two nine two three”

Use the following pronunciation rule:

  • Regex: $begin:math:text$?(\\d{3})$end:math:text$?[ -]?(\d{3})[ -]?(\d{4})
  • Replacement: \1 <break time="0.5s" /> \2 <break time="0.5s" /> \3
  • Case sensitive: FALSE

This uses SSML breaks between capture groups, allowing for natural read-back of phone numbers or similar patterns.

Example: IPA correction

  • Regex: /\bLouvre\b/
  • Replacement: /ˈluːvrə/
  • Case sensitive: FALSE

This ensures “Louvre” is pronounced correctly.