Creating a test set

Create a test set in Cloudera Agent Studio by importing test cases to run an agent against during an evaluation.

A test set is a named collection of test cases. You import the test cases from a file or paste them into the New test set page. The test set is displayed on the Test sets tab of the Evaluations page, and you can select it as the source of an evaluation run.

If you save a test set with the name of an existing test set and the content is different, Agent Studio creates a new version of the test set. If the content is identical to an existing version, Agent Studio does not create a new version.

The New test set page has the following sections:

  • Test set details: The Name of the test set.
  • Agent access: The Allowed agents list. If you leave the list empty, any agent can use the test set. Only agents that have a draft can be added.
  • Test cases: The test cases, as a file or as pasted text.

The page accepts the test cases in one of the following formats:

  • NDJSON, with one JSON object on each line.
  • A JSON array of objects.
  • Pretty-printed JSON objects, with a blank line between each object.

A test set can contain up to 100 test cases.

  • Ensure that your user has the Admin or Builder role. The Test sets tab is not displayed for other roles. See User roles and capabilities.
  • Prepare the test cases. Each test case is a JSON object that has the following fields:
    • input: Required. A non-empty string of up to 64 KiB.
    • id: Optional. A non-empty string. If you omit the field, Agent Studio generates an ID from the input and the run options. Agent Studio rejects a test set in which two test cases have the same ID.
    • expectations: Optional. A JSON object.
    • metadata: Optional. A JSON object. Do not set hitl_required to true, because test cases that require human input are not supported.
    • run_options: Optional. A JSON object. The object cannot contain the keys agent or threadId.
  • Ensure each serialized test case is 256 KiB or smaller.
  • Save the test cases in a file with the extension .ndjson, .jsonl, or .txt, or copy the test cases to paste them into the page.
  • Optional: To limit the test set to specific agents, ensure that each agent has a draft in your authoring workspace. To use a published agent, first copy it to your drafts. In Agent Catalog, open the Actions menu of the agent, and then click Edit.
To create a test set:
  1. Launch the Cloudera Agent Studio console.
  2. In the left navigation pane, click Evaluations.
    The Runs tab is displayed.
  3. Click the Test sets tab.
  4. Click New test set.
    The New test set page is displayed.
  5. In the Test set details section, enter the name of the test set in Name.
    To create a new version of an existing test set, enter the name of that test set.
  6. Optional: To limit the agents that can use the test set, in the Agent access section, click Allowed agents, and then select the agents.
    • To find an agent, enter text in Search….
    • To select every agent in the list, click Select all.
    • To reverse the selection, click Invert selection.
    • To clear the selection, click Clear.
    If you leave Allowed agents empty, the placeholder All agents is displayed, and any agent can use the test set. The list is unavailable if you have no agent drafts. In this case, the message No agent drafts. is displayed, and you can still save an unrestricted test set.
  7. In the Test cases section, add the test cases by using one of the following options.
    • To upload a file, click Choose file, and then select the file.
    • To paste the test cases, click the text area, and then paste the test cases.
    When the page can read the test cases, the text is formatted for readability, and the message number test cases ready is displayed. If the page cannot read the test cases, the Could not parse test cases or Check your NDJSON message lists each error, for example Line 2: invalid JSON. Correct the test cases before you continue.
  8. Click Save.
    The Save button is unavailable until Name has a value and the page can read at least one test case.
    To leave the page without saving, click Cancel, or click Test sets at the top of the page.

The message Created name vversion is displayed, and the page for the test set opens. If the content is identical to an existing version, the message name unchanged (vversion) is displayed instead.

The page for the test set is read-only. The title is the name and the version of the test set, and the page has the Test set details, Versions, Evaluation Runs, and Test cases sections.

On the Test sets tab, the table has the columns Test set, Agent, Size, Version, Last run, and Last result. A test set that no run has used displays Never run in the Last run column. To open the test set, click its row, or click Open menu in the row, and then click View test set.

If the save fails, an error message is displayed.