Tests for your agent

Create tests from real or written conversations, replay them before you publish and compare answers to catch regressions when sources or procedures change.

Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.

A test is a saved conversation with the answer you expect. Replay your tests before every release and you will notice when an edit to a source, a procedure or a setting breaks something that used to work.

Open the agent and select Test > Tests.

Create a test

There are three ways to start.

From the Playground. After an answer you are happy with, select Save as test. See Playground.

From a real conversation. Open the agent's Activity, open a conversation and select Create test. The customer's messages become the test input.

Written by hand.

  1. In Test > Tests, select New test.
  2. Enter a Name, such as Refund after 40 days.
  3. Write the customer's messages, one per line. Add more lines for a multi-turn conversation.
  4. Under Expected, describe what a good answer does: "Offers store credit and does not promise a refund."
  5. Select Save.

You should see the test in the list with the status Not run.

What a test checks

An expected answer is a description, not exact wording. The agent's replies vary a little each time, so each test is judged on meaning.

Check Example
Answer should say "Store credit is offered after 30 days."
Answer should not say "Refund approved."
Procedure The test passes only if Refund request was used.
Action An escalation or a lookup must be called.

Run tests

  1. Select the tests to run, or choose Select all.
  2. Select Run tests.
  3. Wait for results. Each test shows Passed, Failed or Needs review.

Open a result to see the answer next to the expected description, with the same trace you see in the Playground.

Compare runs

Select Compare and choose two runs, such as before and after an edit, or two models. The page lists the tests whose result changed and shows both answers side by side.

Tip: Keep the test set small and meaningful: twenty tests for your most common and most costly requests are more useful than two hundred vague ones.

Run before you publish

Before you publish a new version, run all tests on the draft. If any fail, open them, decide whether the agent or the test is wrong, and fix it. See versions.

Replaying real conversations

Select Replay on a past conversation to send its customer messages to the current draft and see how the new answers differ from what was sent. It is the easiest way to check a change against real customers, without writing any tests.

Keep tests current

When your policy changes, update the expected answer in the same sitting as the procedure. A failing test that nobody trusts is worse than no test.

Something unclear or missing? Tell us and we will fix the page.