Skip to main content
Advanced configuration — This page covers complex platform settings. We recommend completing PolyAcademy Level 1 before proceeding.
When a response matches a stop keyword pattern, the system halts the response and logs the occurrence. Use stop keywords to catch sensitive content, remove unnecessary preambles, or enforce brand adherence.

Stop keyword fields

FieldTypeDescription
TitleStringUnique name for the stop keyword rule (max 100 characters)
DescriptionStringOptional note clarifying the keyword’s purpose
Regular ExpressionStringOne or more regex patterns that identify phrases to control
Say PhrasesBooleanTRUE — the agent speaks the text up to the matched phrase, then stops. FALSE — the agent is interrupted before speaking the phrase.
LanguageStringWhich language this rule applies to. Defaults to “All languages”. Only visible for multilingual agents.
FunctionReferenceOptional — a function to call when the phrase is detected
When a function is triggered by a stop keyword, caller input and LLM parameters are not passed to the function. The function runs without conversation context, so it should return a static response or handle the absence of context gracefully.

Creating a stop keyword

Creating a stop keyword function
Go to Build > Tools to define a custom function for handling stop keywords.Example setup:
  • Name: restricted_phrase
  • Description: Respond when stop keywords are detected.
  • Type: String
  • Function definition:
def restricted_phrase(conv: Conversation):
    return "I can only help with questions about our products and services."

Common use cases

Prevent offensive or harmful language in user interactions.
FieldValue
IDstop_inappropriate
Regex\b(offensiveWord1|offensiveWord2)\b
Say PhrasesTRUE
LLMs often add unnecessary meta-explanations before executing an action. Stop keywords cut these off instantly.Before: “Let’s start by gathering some information. Please hold on while I check your cancellation options. Here are your cancellation options.”After: “Here are your cancellation options.”
1

Add the stop keyword

Go to Channels > Voice > Response control and click Add Phrase:
FieldValue
IDflow_redundancy_cutoff
Regex\b(let's start|please hold on|let me check)\b
Say PhrasesTRUE
2

Optional: redirect to a function

Trigger a function to replace the blocked phrase with a cleaner response:
def flow_redundancy_cutoff(conv: Conversation):
    return "Here are your options."
3

Test

Save and test the agent’s responses in sandbox.
Block responses with phrases outside approved messaging. Log matches for review in the Analytics Dashboard.
Use regex for complex patterns. See regex101.com for a testing tool.
Last modified on March 27, 2026