@salesforce/agents
Version:
Client side APIs for working with Salesforce agents
63 lines (62 loc) • 2.37 kB
TypeScript
import { Connection } from '@salesforce/core';
import { Duration } from '@salesforce/kit';
import { type AgentforceStudioTestStartResponse, type AgentforceStudioTestStatusResponse, type AgentforceStudioTestResultsResponse } from './types.js';
/**
* A service for testing agents using `AiTestingDefinition` metadata (Agentforce Studio).
* Start asynchronous test runs, get or poll for test status, and get detailed test results.
*
* **Examples**
*
* Create an instance of the service:
*
* `const agentTester = new AgentforceStudioTester(connection);`
*
* Start a test run:
*
* `const startResponse = await agentTester.start(aiTestSuiteDefName);`
*
* Get the status for a test run:
*
* `const status = await agentTester.status(startResponse.runId);`
*
* Get detailed results for a test run:
*
* `const results = await agentTester.results(startResponse.runId);`
*/
export declare class AgentforceStudioTester {
private maybeMock;
constructor(connection: Connection);
/**
* Initiates a test run (i.e., AI test suite evaluation).
*
* @param testDefinitionName - The name of the AI test suite definition to run.
* @returns Promise that resolves with the response from starting the test.
*/
start(testDefinitionName: string): Promise<AgentforceStudioTestStartResponse>;
/**
* Get the status of a test run.
*
* @param {string} runId
* @returns {Promise<AgentforceStudioTestStatusResponse>}
*/
status(runId: string): Promise<AgentforceStudioTestStatusResponse>;
/**
* Poll the status of a test run until the tests are complete or the timeout is reached.
*
* @param {string} runId
* @param {Duration} timeout
* @returns {Promise<AgentforceStudioTestResultsResponse>}
*/
poll(runId: string, { timeout }?: {
timeout?: Duration;
}): Promise<AgentforceStudioTestResultsResponse>;
/**
* Get detailed test run results.
*
* @param {string} runId
* @returns {Promise<AgentforceStudioTestResultsResponse>}
*/
results(runId: string): Promise<AgentforceStudioTestResultsResponse>;
}
/** Decodes HTML entities in test result subject responses and scorer responses. */
export declare function normalizeAgentforceStudioResults(results: AgentforceStudioTestResultsResponse): AgentforceStudioTestResultsResponse;