Skip to main content
Assertions are validation checks that verify the 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 use the Check for absence option. This option switches the assertion check to validate the absence of the defined value. With this option, the assertion must still match the exact text or data provided in the assertion. You can activate both Check for absence 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 agent’s response.

Assertion types

Text assertion

Validates text in the 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 agent’s response. Fails if We have received your order is in the 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 agent’s response. Fails if We are preparing your purchase is in the agent’s response.
In this example, configure the assertion as follows:Validates that the agent’s response doesn’t include error, for example, Your order will be shipped shortly. Fails if the agent’s response includes error, for example, We found an error while processing your order.

Data assertion

Validates the data fields and JSON structures of the agent’s message against the data provided in the input field. If the 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
Check for absenceDeactivated
Use partial comparisonDeactivated
Expected data
Validates only the exact JSON object provided in the input field.
In this example, configure the assertion as follows:
ParameterValue
Check for absenceDeactivated
Use partial comparisonActivated
Expected 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
Check for absenceActivated
Use partial comparisonActivated
Expected 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
Check for absenceDeactivated
Use partial comparisonDeactivated
Expected context
Validates only the exact JSON object provided in the input field.
In this example, configure the assertion as follows:
ParameterValue
Check for absenceDeactivated
Use partial comparisonActivated
Expected context
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
Check for absenceActivated
Use partial comparisonActivated
Expected context
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 November 11, 2026