Get Started
Considerations
Authentication
Conversational and Voice Testing Workflow
Create Custom Scorers
Custom Scorer Invocable Actions
Use Test Results to Improve Your Agent
Export Agentforce Session Tracing Data
Use the Agentforce Testing API to test agents and prompt templates at two levels: a single request and response (turn-level) or a full multi-turn exchange (conversation-level).
To create and run tests in the Salesforce UI, see Set Up and Run Tests in Agentforce Studio (Beta) in Salesforce Help. This guide covers the metadata and API side.
The Agentforce Testing API improves on the legacy Testing API in several ways. Conversational tests facilitate evaluations against a common goal over the course of an entire conversation. The new resources also cover multi-agent handoff scenarios, prompt template testing, voice agent quality, and custom scorers.
Turn-level and conversation-level tests use different resources, so decide which one you need before you start. You can use both for the same agent.
| Turn-level | Conversation-level | |
|---|---|---|
| What a test case checks | One utterance and the agent’s response | A multi-turn exchange between a simulated caller and your agent |
| Where test cases live | In an AiTestingDefinition XML file that you deploy to your org and rerun | In the request body. You send the goal, turn limit, and scorers with each run |
| How you run it | Connect API /einstein/ai-testing/runs | Connect API /einstein/ai-testing/conversational-test/run |
| Subjects | Agents and prompt templates | Agents |
| Custom scorers | Supported | Supported |
| Use it for | Regression tests on individual requests, such as the right subagent or action | Workflows where the agent gathers information across turns, such as a password reset. Also voice agent quality |
Metadata API and Connect API are separate. Metadata API holds the AiTestingDefinition type that defines turn-level tests. Connect API runs tests, checks their status, and gets their results.
| Legacy Testing API | Agentforce Testing API | |
|---|---|---|
| Metadata type | AiEvaluationDefinition (v63.0+) | AiTestingDefinition (v66.0+) |
| Test case check | expectation | scorer |
| Connect API resource | /einstein/ai-evaluations/runs | /einstein/ai-testing/runs |
| Start request field | aiEvaluationDefinitionName | testDefinitionName |
| Status values | NEW, IN_PROGRESS, COMPLETED, ERROR, TERMINATED | CREATED, IN_PROGRESS, SUCCESS, FAILED, TERMINATED |
| Results | testCases[].testResults[] | testCases[].testScorerResults[] |
| CLI | --test-runner testing-center | --test-runner agentforce-studio |
The CLI row and the status values apply to turn-level tests.