|
| 1 | +# summary |
| 2 | + |
| 3 | +Run evaluation tests against an Agentforce agent. |
| 4 | + |
| 5 | +# description |
| 6 | + |
| 7 | +Execute rich evaluation tests against an Agentforce agent using the Einstein Evaluation API. Supports both YAML test specs (same format as `sf agent generate test-spec`) and JSON payloads. |
| 8 | + |
| 9 | +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`. |
| 10 | + |
| 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. |
| 12 | + |
| 13 | +Supports 8+ evaluator types, including topic routing assertions, action invocation checks, string/numeric assertions, semantic similarity scoring, and LLM-based quality ratings. |
| 14 | + |
| 15 | +# flags.spec.summary |
| 16 | + |
| 17 | +Path to test spec file (YAML or JSON). Use `-` for stdin. |
| 18 | + |
| 19 | +# flags.api-name.summary |
| 20 | + |
| 21 | +Agent DeveloperName (also called API name) to resolve agent_id and agent_version_id. Auto-inferred from the YAML spec's subjectName. |
| 22 | + |
| 23 | +# flags.wait.summary |
| 24 | + |
| 25 | +Number of minutes to wait for results. |
| 26 | + |
| 27 | +# flags.result-format.summary |
| 28 | + |
| 29 | +Format of the agent test results. |
| 30 | + |
| 31 | +# flags.batch-size.summary |
| 32 | + |
| 33 | +Number of tests per API request (max 5). |
| 34 | + |
| 35 | +# flags.no-normalize.summary |
| 36 | + |
| 37 | +Disable auto-normalization of field names and shorthand references. |
| 38 | + |
| 39 | +# examples |
| 40 | + |
| 41 | +- Run tests using a YAML test spec on the org with alias "my-org": |
| 42 | + |
| 43 | + <%= config.bin %> <%= command.id %> --spec tests/my-agent-testSpec.yaml --target-org my-org |
| 44 | + |
| 45 | +- Run tests using a YAML spec with explicit agent name override; use your default org: |
| 46 | + |
| 47 | + <%= config.bin %> <%= command.id %> --spec tests/my-agent-testSpec.yaml --api-name My_Agent --target-org my-org |
| 48 | + |
| 49 | +- Run tests using a JSON payload: |
| 50 | + |
| 51 | + <%= config.bin %> <%= command.id %> --spec tests/eval-payload.json --target-org my-org |
| 52 | + |
| 53 | +- Run tests and output results in JUnit format; useful for continuous integration and deployment (CI/CD): |
| 54 | + |
| 55 | + <%= config.bin %> <%= command.id %> --spec tests/my-agent-testSpec.yaml --target-org my-org --result-format junit |
| 56 | + |
| 57 | +- Pipe JSON payload from stdin: |
| 58 | + |
| 59 | + $ echo '{"tests":[...]}' | <%= config.bin %> <%= command.id %> --spec - --target-org my-org |
| 60 | + |
| 61 | +# info.batchProgress |
| 62 | + |
| 63 | +Running batch %s of %s (%s tests)... |
| 64 | + |
| 65 | +# info.testComplete |
| 66 | + |
| 67 | +Test %s: %s. |
| 68 | + |
| 69 | +# info.summary |
| 70 | + |
| 71 | +Results: %s passed, %s failed, %s scored, %s errors. |
| 72 | + |
| 73 | +# info.yamlDetected |
| 74 | + |
| 75 | +Detected YAML test spec for agent '%s' with %s test case(s). Translating to Evaluation API format. |
| 76 | + |
| 77 | +# error.invalidPayload |
| 78 | + |
| 79 | +Invalid test payload: %s. |
| 80 | + |
| 81 | +# error.apiError |
| 82 | + |
| 83 | +Einstein Eval API error (HTTP %s): %s |
| 84 | + |
| 85 | +# error.agentNotFound |
| 86 | + |
| 87 | +No agent found with DeveloperName (also API name) '%s'. Verify that the agent exists in the target org. |
| 88 | + |
| 89 | +# error.agentVersionNotFound |
| 90 | + |
| 91 | +No published version found for agent '%s'. Make sure the agent has been published at least once. |
0 commit comments