Skip to content

Commit 2d173b2

Browse files
docs: bring Juliet's suggestions, change to --api-name
1 parent 1f9577e commit 2d173b2

File tree

4 files changed

+36
-36
lines changed

4 files changed

+36
-36
lines changed

command-snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
"flagAliases": [],
220220
"flagChars": ["n", "o", "s", "w"],
221221
"flags": [
222-
"agent-api-name",
222+
"api-name",
223223
"api-version",
224224
"batch-size",
225225
"flags-dir",

messages/agent.test.run-eval.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ Execute rich evaluation tests against an Agentforce agent using the Einstein Eva
88

99
When you provide a YAML test spec, the command automatically translates test cases into Evaluation API calls and infers the agent name from the spec's `subjectName` field. This means you can use the same test spec with both `sf agent test run` and `sf agent test run-eval`.
1010

11-
When you provide a JSON payload, it's sent directly to the API with optional normalization. The normalizer auto-corrects common field name mistakes, converts shorthand references to JSONPath, and injects defaults. Use `--no-normalize` to disable.
11+
When you provide a JSON payload, it's sent directly to the API with optional normalization. The normalizer auto-corrects common field name mistakes, converts shorthand references to JSONPath, and injects defaults. Use `--no-normalize` to disable this auto-normalization.
1212

13-
Supports 8+ evaluator types including topic routing assertions, action invocation checks, string/numeric assertions, semantic similarity scoring, and LLM-based quality ratings.
13+
Supports 8+ evaluator types, including topic routing assertions, action invocation checks, string/numeric assertions, semantic similarity scoring, and LLM-based quality ratings.
1414

1515
# flags.spec.summary
1616

1717
Path to test spec file (YAML or JSON). Use `-` for stdin.
1818

19-
# flags.agent-api-name.summary
19+
# flags.api-name.summary
2020

21-
Agent DeveloperName to resolve agent_id and agent_version_id. Auto-inferred from YAML spec's subjectName.
21+
Agent DeveloperName (also called API name) to resolve agent_id and agent_version_id. Auto-inferred from the YAML spec's subjectName.
2222

2323
# flags.wait.summary
2424

2525
Number of minutes to wait for results.
2626

2727
# flags.result-format.summary
2828

29-
Output format: human, json, junit, or tap.
29+
Format of the agent test results.
3030

3131
# flags.batch-size.summary
3232

@@ -38,54 +38,54 @@ Disable auto-normalization of field names and shorthand references.
3838

3939
# examples
4040

41-
- Run tests from a YAML test spec:
41+
- Run tests using a YAML test spec on the org with alias "my-org":
4242

4343
<%= config.bin %> <%= command.id %> --spec tests/my-agent-testSpec.yaml --target-org my-org
4444

45-
- Run tests from a YAML spec with explicit agent name override:
45+
- Run tests using a YAML spec with explicit agent name override; use your default org:
4646

47-
<%= config.bin %> <%= command.id %> --spec tests/my-agent-testSpec.yaml --agent-api-name My_Agent --target-org my-org
47+
<%= config.bin %> <%= command.id %> --spec tests/my-agent-testSpec.yaml --api-name My_Agent --target-org my-org
4848

49-
- Run tests from a JSON payload:
49+
- Run tests using a JSON payload:
5050

5151
<%= config.bin %> <%= command.id %> --spec tests/eval-payload.json --target-org my-org
5252

53-
- JUnit output for CI/CD:
53+
- Run tests and output results in JUnit format; useful for continuous integration and deployment (CI/CD):
5454

5555
<%= config.bin %> <%= command.id %> --spec tests/my-agent-testSpec.yaml --target-org my-org --result-format junit
5656

5757
- Pipe JSON payload from stdin:
5858

59-
echo '{"tests":[...]}' | <%= config.bin %> <%= command.id %> --spec - --target-org my-org
59+
$ echo '{"tests":[...]}' | <%= config.bin %> <%= command.id %> --spec - --target-org my-org
6060

6161
# info.batchProgress
6262

6363
Running batch %s of %s (%s tests)...
6464

6565
# info.testComplete
6666

67-
Test %s: %s
67+
Test %s: %s.
6868

6969
# info.summary
7070

71-
Results: %s passed, %s failed, %s scored, %s errors
71+
Results: %s passed, %s failed, %s scored, %s errors.
7272

7373
# info.yamlDetected
7474

7575
Detected YAML test spec for agent '%s' with %s test case(s). Translating to Evaluation API format.
7676

7777
# error.invalidPayload
7878

79-
Invalid test payload: %s
79+
Invalid test payload: %s.
8080

8181
# error.apiError
8282

8383
Einstein Eval API error (HTTP %s): %s
8484

8585
# error.agentNotFound
8686

87-
No agent found with DeveloperName '%s'. Verify the agent exists in the target org.
87+
No agent found with DeveloperName (also API name) '%s'. Verify that the agent exists in the target org.
8888

8989
# error.agentVersionNotFound
9090

91-
No published version found for agent '%s'. Ensure the agent has been published at least once.
91+
No published version found for agent '%s'. Make sure the agent has been published at least once.

src/commands/agent/test/run-eval.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ export default class AgentTestRunEval extends SfCommand<RunEvalResult> {
148148
summary: messages.getMessage('flags.spec.summary'),
149149
allowStdin: true,
150150
}),
151-
'agent-api-name': Flags.string({
151+
'api-name': Flags.string({
152152
char: 'n',
153-
summary: messages.getMessage('flags.agent-api-name.summary'),
153+
summary: messages.getMessage('flags.api-name.summary'),
154154
}),
155155
wait: Flags.integer({
156156
char: 'w',
@@ -190,14 +190,14 @@ export default class AgentTestRunEval extends SfCommand<RunEvalResult> {
190190

191191
// 2. Detect format and parse
192192
let payload: EvalPayload;
193-
let agentApiName = flags['agent-api-name'];
193+
let agentApiName = flags['api-name'];
194194

195195
if (isYamlTestSpec(rawContent)) {
196196
// YAML TestSpec detected — translate to EvalPayload
197197
const spec = parseTestSpec(rawContent);
198198
payload = translateTestSpec(spec);
199199

200-
// Auto-infer agent-api-name from subjectName if not explicitly provided
200+
// Auto-infer api-name from subjectName if not explicitly provided
201201
if (!agentApiName) {
202202
agentApiName = spec.subjectName;
203203
this.log(messages.getMessage('info.yamlDetected', [spec.subjectName, spec.testCases.length.toString()]));
@@ -215,7 +215,7 @@ export default class AgentTestRunEval extends SfCommand<RunEvalResult> {
215215
throw messages.createError('error.invalidPayload', ['missing or empty "tests" array']);
216216
}
217217

218-
// 3. If --agent-api-name (or auto-inferred from YAML), resolve IDs and inject
218+
// 3. If --api-name (or auto-inferred from YAML), resolve IDs and inject
219219
if (agentApiName) {
220220
const { agentId, versionId } = await resolveAgent(org, agentApiName);
221221
for (const test of payload.tests) {

test/nuts/agent.test.run-eval.nut.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('agent test run-eval', function () {
3737

3838
describe('run-eval with JSON file', () => {
3939
it('should run evaluation with JSON payload file', async () => {
40-
const command = `agent test run-eval --spec ${jsonPayloadPath} --agent-api-name Local_Info_Agent --target-org ${getUsername()} --json`;
40+
const command = `agent test run-eval --spec ${jsonPayloadPath} --api-name Local_Info_Agent --target-org ${getUsername()} --json`;
4141
const output = execCmd<RunEvalResult>(command, {
4242
ensureExitCode: 0,
4343
}).jsonOutput;
@@ -53,7 +53,7 @@ describe('agent test run-eval', function () {
5353
});
5454

5555
it('should run evaluation with normalized payload', async () => {
56-
const command = `agent test run-eval --spec ${jsonPayloadPath} --agent-api-name Local_Info_Agent --target-org ${getUsername()} --json`;
56+
const command = `agent test run-eval --spec ${jsonPayloadPath} --api-name Local_Info_Agent --target-org ${getUsername()} --json`;
5757
const output = execCmd<RunEvalResult>(command, {
5858
ensureExitCode: 0,
5959
}).jsonOutput;
@@ -84,15 +84,15 @@ describe('agent test run-eval', function () {
8484
ensureExitCode: 0,
8585
}).jsonOutput;
8686

87-
// Should succeed without explicit --agent-api-name flag
87+
// Should succeed without explicit --api-name flag
8888
expect(output?.result).to.be.ok;
8989
expect(output?.result.tests).to.be.an('array');
9090
});
9191
});
9292

9393
describe('run-eval with stdin', () => {
9494
it('should run evaluation with JSON payload from stdin', async () => {
95-
const command = `cat ${jsonPayloadPath} | sf agent test run-eval --spec - --agent-api-name Local_Info_Agent --target-org ${getUsername()} --json`;
95+
const command = `cat ${jsonPayloadPath} | sf agent test run-eval --spec - --api-name Local_Info_Agent --target-org ${getUsername()} --json`;
9696
const output = execCmd<RunEvalResult>(command, {
9797
ensureExitCode: 0,
9898
cli: 'sf',
@@ -118,7 +118,7 @@ describe('agent test run-eval', function () {
118118

119119
describe('run-eval with flags', () => {
120120
it('should respect --no-normalize flag', async () => {
121-
const command = `agent test run-eval --spec ${jsonPayloadPath} --agent-api-name Local_Info_Agent --no-normalize --target-org ${getUsername()} --json`;
121+
const command = `agent test run-eval --spec ${jsonPayloadPath} --api-name Local_Info_Agent --no-normalize --target-org ${getUsername()} --json`;
122122
const output = execCmd<RunEvalResult>(command, {
123123
ensureExitCode: 0,
124124
}).jsonOutput;
@@ -128,7 +128,7 @@ describe('agent test run-eval', function () {
128128
});
129129

130130
it('should use custom batch size', async () => {
131-
const command = `agent test run-eval --spec ${jsonPayloadPath} --agent-api-name Local_Info_Agent --batch-size 1 --target-org ${getUsername()} --json`;
131+
const command = `agent test run-eval --spec ${jsonPayloadPath} --api-name Local_Info_Agent --batch-size 1 --target-org ${getUsername()} --json`;
132132
const output = execCmd<RunEvalResult>(command, {
133133
ensureExitCode: 0,
134134
}).jsonOutput;
@@ -139,7 +139,7 @@ describe('agent test run-eval', function () {
139139

140140
it('should support different result formats', async () => {
141141
// Test human format (default)
142-
const humanCommand = `agent test run-eval --spec ${jsonPayloadPath} --agent-api-name Local_Info_Agent --result-format human --target-org ${getUsername()}`;
142+
const humanCommand = `agent test run-eval --spec ${jsonPayloadPath} --api-name Local_Info_Agent --result-format human --target-org ${getUsername()}`;
143143
const humanOutput = execCmd(humanCommand, {
144144
ensureExitCode: 0,
145145
}).shellOutput.stdout;
@@ -148,15 +148,15 @@ describe('agent test run-eval', function () {
148148
expect(humanOutput).to.be.a('string');
149149

150150
// Test tap format
151-
const tapCommand = `agent test run-eval --spec ${jsonPayloadPath} --agent-api-name Local_Info_Agent --result-format tap --target-org ${getUsername()}`;
151+
const tapCommand = `agent test run-eval --spec ${jsonPayloadPath} --api-name Local_Info_Agent --result-format tap --target-org ${getUsername()}`;
152152
const tapOutput = execCmd(tapCommand, {
153153
ensureExitCode: 0,
154154
}).shellOutput.stdout;
155155

156156
expect(tapOutput).to.include('TAP version');
157157

158158
// Test junit format
159-
const junitCommand = `agent test run-eval --spec ${jsonPayloadPath} --agent-api-name Local_Info_Agent --result-format junit --target-org ${getUsername()}`;
159+
const junitCommand = `agent test run-eval --spec ${jsonPayloadPath} --api-name Local_Info_Agent --result-format junit --target-org ${getUsername()}`;
160160
const junitOutput = execCmd(junitCommand, {
161161
ensureExitCode: 0,
162162
}).shellOutput.stdout;
@@ -169,7 +169,7 @@ describe('agent test run-eval', function () {
169169
describe('run-eval error handling', () => {
170170
it('should fail with invalid JSON payload', async () => {
171171
const invalidJson = join(mockProjectDir, 'invalid-payload.json');
172-
const command = `agent test run-eval --spec ${invalidJson} --agent-api-name Local_Info_Agent --target-org ${getUsername()} --json`;
172+
const command = `agent test run-eval --spec ${invalidJson} --api-name Local_Info_Agent --target-org ${getUsername()} --json`;
173173

174174
try {
175175
execCmd<RunEvalResult>(command);
@@ -180,7 +180,7 @@ describe('agent test run-eval', function () {
180180
});
181181

182182
it('should fail when agent not found', async () => {
183-
const command = `agent test run-eval --spec ${jsonPayloadPath} --agent-api-name NonExistentAgent --target-org ${getUsername()} --json`;
183+
const command = `agent test run-eval --spec ${jsonPayloadPath} --api-name NonExistentAgent --target-org ${getUsername()} --json`;
184184

185185
try {
186186
execCmd<RunEvalResult>(command);
@@ -191,7 +191,7 @@ describe('agent test run-eval', function () {
191191
});
192192

193193
it('should require --spec flag', async () => {
194-
const command = `agent test run-eval --agent-api-name Local_Info_Agent --target-org ${getUsername()} --json`;
194+
const command = `agent test run-eval --api-name Local_Info_Agent --target-org ${getUsername()} --json`;
195195

196196
try {
197197
execCmd<RunEvalResult>(command);
@@ -204,7 +204,7 @@ describe('agent test run-eval', function () {
204204

205205
describe('run-eval output structure', () => {
206206
it('should include test summaries with correct structure', async () => {
207-
const command = `agent test run-eval --spec ${jsonPayloadPath} --agent-api-name Local_Info_Agent --target-org ${getUsername()} --json`;
207+
const command = `agent test run-eval --spec ${jsonPayloadPath} --api-name Local_Info_Agent --target-org ${getUsername()} --json`;
208208
const output = execCmd<RunEvalResult>(command, {
209209
ensureExitCode: 0,
210210
}).jsonOutput;
@@ -218,7 +218,7 @@ describe('agent test run-eval', function () {
218218
});
219219

220220
it('should include summary with all metrics', async () => {
221-
const command = `agent test run-eval --spec ${jsonPayloadPath} --agent-api-name Local_Info_Agent --target-org ${getUsername()} --json`;
221+
const command = `agent test run-eval --spec ${jsonPayloadPath} --api-name Local_Info_Agent --target-org ${getUsername()} --json`;
222222
const output = execCmd<RunEvalResult>(command, {
223223
ensureExitCode: 0,
224224
}).jsonOutput;

0 commit comments

Comments
 (0)