Skip to main content
Updated in 2025.19 Assertions are validation checks that verify the AI Agent’s responses and different aspects of the Flow for each Step during a Playbook run.

How to Use Assertions

Assertions include an input field where you can provide the text or data you want to validate during the Playbook run. Assertions are case-sensitive. The text, Intent names, Slot names, and data fields that you enter in the input field must match exactly what you want to validate. Specific assertion types include an option to validate only a portion of the provided text or data:
  • Use fuzzy search — for text assertions.
  • Use partial comparison — for data and context assertions.
The fuzzy search functionality handles case-insensitive matches, differences in spaces, tab stops, and newlines, and escaped characters.
You can also invert the assertion check with the Invert assertion option. This option switches the assertion check to validate the absence of the defined value. Inverted assertions must also match the exact text or data provided in the assertion. You can activate both Invert assertion and Use fuzzy search to validate the absence of a portion of the provided text or data, for example, only the "status": "active" JSON property or the word "error" in the AI Agent’s response.

Assertion Types

Text Assertion

Validates text in the AI Agent’s response against the expected text or pattern provided in the input field.

Examples

In this example, configure the assertion as follows:Validates that Your order has been confirmed is present in the AI Agent’s response. Fails if We have received your order is in the AI Agent’s response.
In this example, configure the assertion as follows:Validates that Your order has been confirmed and We have received your order are in the AI Agent’s response. Fails if We are preparing your purchase is in the AI Agent’s response.
In this example, configure the assertion as follows:Validates that the AI Agent’s response doesn’t include error, for example, Your order will be shipped shortly. Fails if the AI Agent’s response includes error, for example, We found an error while processing your order.

Data Assertion

Validates the AI Agent message’s data fields and JSON structures against the data provided in the input field. If the AI Agent’s response doesn’t include any data fields, the Assertion checks data fields in the user input.

Examples

In this example, configure the assertion as follows:
ParameterValue
Invert assertionDeactivated
Use partial comparisonDeactivated
Data
Validates only the exact JSON object provided in the input field.
In this example, configure the assertion as follows:
ParameterValue
Invert assertionDeactivated
Use partial comparisonActivated
Data
Validates any JSON structure that contains the JSON object provided in the input field, for example:
Fails if the JSON structure doesn’t contain the JSON object provided in the input field, for example:
In this example, configure the assertion as follows:
ParameterValue
Invert assertionActivated
Use partial comparisonActivated
Data
Validates any JSON structure that doesn’t contain the JSON object provided in the input field, for example:

Intent Assertion

Validates that the Intent provided in the input field has been recognized in the user input.

Examples

In this example, configure the assertion as follows:Validates only that the "greet.hello" Intent has been recognized.
In this example, configure the assertion as follows:Validates that the "cancel.order" Intent hasn’t been recognized.

Slot Assertion

Validates that the Slot provided in the input field has been recognized in the user input.

Examples

In this example, configure the assertion as follows:Validates only that the username Slot has been recognized.
In this example, configure the assertion as follows:Validates that the password Slot hasn’t been recognized.

Context Assertion

Validates the data in the Context object against the data provided in the input field.

Examples

In this example, configure the assertion as follows:
ParameterValue
Invert assertionDeactivated
Use partial comparisonDeactivated
Context data
Validates only the exact JSON object provided in the input field.
In this example, configure the assertion as follows:
ParameterValue
Invert assertionDeactivated
Use partial comparisonActivated
Context data
Validates any context data that contains the JSON object provided in the input field, for example:
Fails if the JSON structure doesn’t contain the JSON object provided in the input field, for example:
In this example, configure the assertion as follows:
ParameterValue
Invert assertionActivated
Use partial comparisonActivated
Context data
Validates any JSON structure that doesn’t contain the JSON object provided in the input field, for example:

State Assertion

Validates the conversation state.

Examples

In this example, configure the assertion as follows:Validates only that the waiting_for_input State is active.
In this example, configure the assertion as follows:Validates only that the error_state State isn’t active.

Best Practices

For testing best practices, see Best Practices: Testing your Virtual Agents with Playbooks.

More Information

Last modified on April 21, 2026