Run Tests with Agentforce Testing Connect API

After you deploy an AiTestingDefinition for turn-level testing, use the /einstein/ai-testing Connect API resources to run it, check its status, and get its results. To create an external client app and access token, see Set Up Authentication for Testing API.

Run Tests Workflow 

  1. Start a run. Send the API name of your deployed AiTestingDefinition in testDefinitionName. The response returns a runId.
  2. Poll for status. Request the run by its runId until the status is SUCCESS, FAILED, or TERMINATED.
  3. Get the results. Request the results for the run by its runId.

Understand the Results 

The results response has these parts:

  • status is the status of the run.
  • summary gives totals for the run, such as totalNumberOfTestCases.
  • testCases has one entry per test case. Each entry has a testCaseId, a testNumber, the agent’s subjectResponse, and a testScorerResults array.

Each entry in testScorerResults has a scorerName and a scorerResponse. The scorerName is a display name, such as Task Resolution Evaluation, not the scorer’s API name, such as task_resolution. To identify the scorer programmatically, use evaluationType in the scorerResponse, such as evaluator.task_resolution.

For endpoints, request and response fields, and errors, see Agentforce Testing Center Resources in the Connect REST API reference.

See Also