Skip to contentSkip to navigationSkip to topbar
Page tools
Useful for sharing or LLM
Accelerate development with AI

On this page
Looking for more inspiration?Visit the

Use Twilio-authored language operators


Twilio-authored language operators are pre-built GenAI operators that simplify adding AI-powered intelligence to your communications workflows. They are optimized for scale, latency, and accuracy, and can be triggered in real time or at a defined point in the conversation across channels, including Voice, SMS, WhatsApp, RCS, and Chat.


Why use Twilio-authored language operators?

why-use-twilio-authored-language-operators page anchor
  • Faster time to value: Launch common intelligence use cases quickly without designing from scratch. Start with pre-built prompts and tailor them to your policies and domain, reducing trial-and-error prompt engineering.
  • Reduced operational overhead: Spend less effort maintaining custom AI logic and focus on configuration (such as scripts, knowledge, user context) instead of building full systems.
  • Composable building blocks: Combine language operators to support end-to-end workflows like real-time assist and post-call automation.

Available Twilio-authored language operators

available-twilio-authored-language-operators page anchor

Twilio-authored language operators include:

To use Twilio-authored language operators, include them when you define rules for your intelligence configuration.


Triggers and rule execution

triggers-and-rule-execution page anchor

A trigger determines when your rule and its attached language operators run during the conversation lifecycle. For more information, see available triggers and on-demand rule execution.


Script Adherence operator

script-adherence-operator page anchor

Operator ID: intelligence_operator_01kf34tcyefpyb1t4m0nbd8rxg

The Script Adherence operator helps customer care centers shift from post-call Quality Management (QM) to in-the-moment course correction. It provides agents with real-time guidance during active conversations to help them stay compliant.

Script Adherence operator use cases

script-adherence-operator-use-cases page anchor
  • Language guidance: Ensure agents use required language and avoid prohibited language during interactions.
  • Upsell: Encourage agents to deliver offer and value messaging when it's relevant.
  • Faster onboarding: Onboard new agents quickly with live guidance.

Script Adherence operator configuration

script-adherence-operator-configuration page anchor

To configure the Script Adherence operator, add your script when configuring the operator. Each script uses the following format:

  • Category: The name of the stage. For example, Greeting, Verification, or Closing.
  • Criteria: One or more criteria under each category, each formatted as a dash, a unique criteria key, a colon, and a description.
(information)

Required phrases and false positives

The GPT-5.4-mini model evaluates general adherence rather than exact phrase matching. When you specify "Required Phrases", the model might mark the category as succeeded even if the agent didn't use the exact wording, which can result in false positives.

Learn more about writing effective criteria in Script Adherence best practices.

Example: Script Adherence input script

example-script-adherence-input-script page anchor
1
Category: introduction
2
- introduction: The agent should identify themselves by first name. Required Phrase: Thank you for calling Owl Health, this is [Agent Name].
3
4
Category: assistance
5
- offer_assistance: The agent should offer assistance or ask how they could help.
6
7
Category: security
8
- security_justification: The agent should clearly explain the need to verify the caller's identity before discussing account details.
9
- security_full_name: The agent should request the member's full name as it appears on the account. Required Phrase: May I confirm your first and last name as it appears on the account?
10
- security_additional_information: The agent should request at least one additional required identifier (e.g. date of birth, member ID, or address).
11
12
Category: protected_data
13
- phi: The agent should avoid disclosing PHI prior to completing verification.
14
15
Category: diligence
16
- call_reason_confirmation: The agent should restate or confirm the caller's reason for calling. Required Phrase: Just to confirm, you're calling about [issue], is that correct?
17
- specify_disclaimers: The agent should provide required disclaimers when discussing benefits, coverage, or eligibility. Required Phrase: Benefits are subject to eligibility and plan provisions at the time services are rendered.
18
- payment_or_coverage_guarantees: The agent should avoid guaranteeing payment or coverage when discussing claims or coverage.
19
20
Category: wrap_up
21
- clear_timelines_or_next_steps: The agent should set clear expectations for timelines or next steps, if applicable.
22
- closing_recap: The agent should recap actions taken and use the customer's name while closing out.

Script Adherence operator output schema

script-adherence-operator-output-schema page anchor

The Script Adherence operator evaluates the transcript against the criteria and outputs a JSON object. The JSON object contains a single categories array property. The categories array contains a set of items with two properties; a category_key property and a criteria property. The category_key property is a string containing the name of a category; this name is taken from the provided script. The criteria property is an array containing criteria items. A criteria item contains a criteria_key and a criteria_met property. The criteria_key is the criteria key specified in the script. The criteria_met property is a string containing a value indicating if the criteria was met or not. A criteria_met key will always have a value of either Succeeded or Failed.

Example: Script Adherence output

example-script-adherence-output page anchor
1
{
2
"categories": [
3
{
4
"category_key": "introduction",
5
"criteria": [
6
{
7
"criteria_key": "introduction",
8
"criteria_met": "Succeeded"
9
}
10
]
11
},
12
{
13
"category_key": "assistance",
14
"criteria": [
15
{
16
"criteria_key": "offer_assistance",
17
"criteria_met": "Failed"
18
}
19
]
20
},
21
{
22
"category_key": "security",
23
"criteria": [
24
{
25
"criteria_key": "security_justification",
26
"criteria_met": "Succeeded"
27
},
28
{
29
"criteria_key": "security_full_name",
30
"criteria_met": "Failed"
31
},
32
{
33
"criteria_key": "security_additional_information",
34
"criteria_met": "Failed"
35
}
36
]
37
},
38
...
39
]
40
}

Each output response has a maximum limit of 8,800 characters. When designing complex script adherence, we recommend streamlining your requirements to avoid exceeding this threshold. Learn more about schema guidelines.

Each category and criterion you add when designing your Script Adherence operator increase the number of output characters in the generated response. To reduce output length, limit the number of Categories and Criteria, and use simple, descriptive values for Category names and Criteria keys. Use common words or standard abbreviations, and avoid obscure code words. For example, for an agent introduction criterion key, use intro instead of agent_int.


Next Best Response (NBR) operator

next-best-response-nbr-operator page anchor

Operator ID: intelligence_operator_01kea27sy7ffsafmtsfp17nzx4

The NBR operator acts as a live co-pilot for agents, analyzing the conversation in real time and recommending the most effective next message or action based on your business rules and knowledge. This can help agents respond faster and improve First Call Resolution (FCR).

  • Shorter handle time: Suggest ready-to-send responses and next steps.
  • Consistent tone and policy: Keep tone and policy aligned across teams with standardized, approved guidance.
  • Accurate information: Surface the most relevant knowledge article or procedure to prevent misinformation and rework.

How the NBR operator works

how-the-nbr-operator-works page anchor

The operator synthesizes three data streams to generate recommendations:

  • Live Conversation: Captures real-time context and intent from the active transcript.
  • Enterprise Knowledge: Cross-references the conversation with your uploaded company manuals, FAQs, and policies.
  • Customer Memory: Uses historical interaction data and customer profiles to personalize the response.

NBR operator configuration

nbr-operator-configuration page anchor
  • Tone customization: Define a custom tone for responses (for example, "professional" or "friendly") to match your brand.
  • Performance optimization: The NBR operator uses the GPT-5.4-mini model and limits each generation to one knowledge base lookup (tool call), targeting sub-3-second real-time latency.
  • Grounded responses (AI guardrails): Suggestions are derived only from the provided Enterprise Knowledge and Customer Memory. If no relevant context is found, the operator suppresses the response rather than hallucinating. Responses maintain a professional tone without flowery or redundant AI prose.

Operator ID: intelligence_operator_01kcv35pnkeysaf6z6cqtbpegn

The Summary operator generates concise summaries of customer interactions. The Summary operator uses GPT-4o-mini.

Summary operator use cases

summary-operator-use-cases page anchor
  • After-call summary: Generate summaries for agents to review after each call.
  • Case note: Create case notes for Customer Relationship Management (CRM) systems.
  • Handoffs: Help smooth transitions between agents or departments.
  • Audit: Ensure compliance and quality control.

Summary operator configuration

summary-operator-configuration page anchor

You can configure the Summary operator based on your use case and needs. For example, you can specify the level of detail, the format of the summary, or when the summary should be generated.

You can set the summary length to:

  • short
  • medium (default, 3-5 sentences)
  • long

You can specify a structural format for the summary, such as bullet points, STAR (Situation, Task, Action, Result), or SOAP notes for medical contexts.


Operator ID: intelligence_operator_01kcrvw16kfa88qvgrfmr7y151

The Sentiment operator evaluates the sentiment of the conversation.

Note: The Sentiment operator doesn't analyze a specific participant of the conversation.

Sentiment operator result

sentiment-operator-result page anchor
  • positive: The sentiment of the conversation was positive.
  • negative: The sentiment of the conversation was negative.
  • neutral: The sentiment of the conversation was neutral.
  • mixed: There was more than one sentiment detected during the conversation.

Task Completion operator (public beta)

task-completion-operator-public-beta page anchor
(new)

Public beta

Task Completion and Hallucination Detection operators are currently in public beta and the information contained in this document is subject to change. Some features are not yet implemented and others may be changed before the product is declared as generally available. Public beta products are not covered by the Twilio Support Terms or Twilio Service Level Agreement.

Task Completion and Hallucination Detection operators are not PCI compliant or a HIPAA Eligible Service and should not be used in workflows that are subject to HIPAA or PCI.

Conversations products are only available in the new Twilio Console(link takes you to an external page). If your account hasn't been migrated, you'll be redirected to the legacy Console where these products won't appear.

Operator ID: intelligence_operator_04aesmz370ev5vz77jed2vec1k

The Task Completion operator evaluates whether an agent completed the customer's task. It runs when the conversation ends and returns a label with a one-sentence reason. While this operator's primary purpose is to measure the effectiveness of AI agents, this can also be used to measure if human agents were able to solve the customer's problem without having to escalate.

Task Completion operator use cases

task-completion-operator-use-cases page anchor
  • Measure self-service containment: Track how many conversations your AI agent resolved without a human and how many were escalated.
  • Agent effectiveness: Find the conversations where customers didn't get what they needed.
  • Track agent compliance: Track conversations where the agent declined to answer the customer's question due to compliance or guardrails.

For a detailed guide on supervising AI agents with Task Completion and Hallucination Detection, see Supervise AI agents.

How the Task Completion operator works

how-the-task-completion-operator-works page anchor

The operator reads the full conversation and identifies the customer's primary stated goal from their opening turns. It then reads the customer's reaction to the agent's response. The operator returns a label and a one-sentence reason that cites the moment that drove the label.

The operator evaluates the primary task in the conversation and ignores follow-up tasks. If the customer's intent is too vague to evaluate, the operator returns UNRESOLVED.

Task Completion operator result

task-completion-operator-result page anchor

The operator returns a label and a reason.

labelDescription
RESOLVEDThe agent addressed the customer's task, with the customer confirming resolution explicitly or implicitly.
UNRESOLVEDThe agent didn't address the task and the conversation ended without resolution.
ESCALATEDThe conversation was handed off to a human.
AGENT_DECLINEDThe agent deliberately refused because of a policy, compliance, or scope guardrail.

Example: Task Completion output

example-task-completion-output page anchor
1
{
2
"label": "RESOLVED",
3
"reason": "Customer confirmed 'perfect, thank you' after agent reset the password successfully"
4
}

Task Completion operator limitations

task-completion-operator-limitations page anchor
  • The reason field is free text. You can't filter on it in Conversation Insights.
  • If your agent gives a vague or unhelpful answer to an out-of-scope request instead of declining it, the operator returns UNRESOLVED, because it can't distinguish that from a genuine failure. Design your agent to decline out-of-scope requests explicitly so they return AGENT_DECLINED.

Hallucination Detection operator (public beta)

hallucination-detection-operator-public-beta page anchor
(new)

Public beta

Task Completion and Hallucination Detection operators are currently in public beta and the information contained in this document is subject to change. Some features are not yet implemented and others may be changed before the product is declared as generally available. Public beta products are not covered by the Twilio Support Terms or Twilio Service Level Agreement.

Task Completion and Hallucination Detection operators are not PCI compliant or a HIPAA Eligible Service and should not be used in workflows that are subject to HIPAA or PCI.

Conversations products are only available in the new Twilio Console(link takes you to an external page). If your account hasn't been migrated, you'll be redirected to the legacy Console where these products won't appear.

Operator ID: intelligence_operator_01m4wvhe37ebarkr9wbhy2w3n4

The Hallucination Detection operator finds statements your AI agent made that are factually incorrect or inconsistent. It runs when the conversation ends and returns every flagged statement along with what the source says.

Hallucination Detection operator use cases

hallucination-detection-operator-use-cases page anchor
  • Catch inaccurate answers: Find conversations where the agent contradicted your knowledge base.
  • Catch inconsistent answers: Find conversations where the agent contradicted itself.
  • Pair with Task Completion: A conversation can end politely with the task marked RESOLVED while the agent gave the customer the wrong refund window. Using both operators shows whether the agent solved the problem with accurate information.

For a detailed guide on supervising AI agents with Task Completion and Hallucination Detection, see Supervise AI agents.

How the Hallucination Detection operator works

how-the-hallucination-detection-operator-works page anchor

The operator extracts the factual claims your agent made, such as policies, prices, and dates, and checks each one against your Enterprise Knowledge, Conversation Memory, and the conversation itself. It uses only the context you provide and never searches the web, so a claim your knowledge base doesn't cover isn't treated as wrong.

Hallucination Detection operator output schema

hallucination-detection-operator-output-schema page anchor
FieldTypeDescription
hallucination_detectedbooleanWhether one or more hallucinations were found.
hallucination_countintegerThe number of findings that aren't context gaps.
hallucinationsarrayOne entry per finding. Empty when nothing was flagged.
hallucinations[].typestringThe conflict type (external_context_conflict, conversation_context_conflict, or context_gap). See conflict types below.
hallucinations[].sourcestring(Optional) The context source the finding relates to: knowledge, memory, or both. Can be set on any conflict type, including context_gap.
hallucinations[].evidencestringThe flagged agent utterance. Always present.
hallucinations[].expectedstring(Optional) What the source actually says, paraphrased. Set only for conflict types.

The conflict types include:

  • external_context_conflict: The claim contradicts your Enterprise Knowledge, Conversation Memory, or both.
  • conversation_context_conflict: The claim contradicts something the agent said earlier in the conversation, or is clearly fabricated.
  • context_gap: The claim can't be verified against your knowledge, memory, or the conversation.

Example: Conflict plus a context gap

example-conflict-plus-a-context-gap page anchor
1
{
2
"hallucination_detected": true,
3
"hallucination_count": 1,
4
"hallucinations": [
5
{
6
"type": "external_context_conflict",
7
"source": "knowledge",
8
"evidence": "We have a 60-day return period",
9
"expected": "The returns period is 30 days"
10
},
11
{
12
"type": "context_gap",
13
"evidence": "our warehouse team usually ships same-day"
14
}
15
]
16
}

Example: No hallucination detected

example-no-hallucination-detected page anchor
1
{
2
"hallucination_detected": false,
3
"hallucination_count": 0,
4
"hallucinations": []
5
}

Hallucination Detection operator configuration

hallucination-detection-operator-configuration page anchor

You can configure the operator to check your agent's statements against your knowledge base, or detect contradictions within the conversation if you don't provide one.

To use your knowledge base for hallucination detection, select it when you define a rule with language operators.

Hallucination operator limitations

hallucination-operator-limitations page anchor

The hallucination_count field might not match the number of items in the hallucinations array. The operator uses an AI model to fill in this field, and the model can occasionally miscount. For the correct count, count the items in the array.