Build Tests in Metadata API
To define tests, use the AiEvaluationDefinition
Metadata API type. To learn how to use Metadata API, see Quick Start: Metadata API.
To use Salesforce CLI to create agent tests instead of directly using Metadata API, see Test an Agent with Agentforce DX.
The AiEvaluationDefinition
metadata type contains a set of test cases. Each test case takes inputs (including an utterance) and contains a set of expectations (such as an expected action sequence) for the response.
This sample XML AiEvaluationDefinition
has two test cases for the Agentforce_for_Salesforce
agent. The first test case provides an utterance (“Summarize the Global Media account”) and defines multiple expectations for the response.
- The first expectation verifies that the
OOTBSingleRecordSummary
topic is used. - The second expectation verifies that the
IdentifyRecordByName
action is used. - The third expectation includes a string that's expected in the test response.
To deploy metadata components with Salesforce CLI, see Salesforce CLI Command Reference.