@salesforce/plugin-agent 1.36.0 → 1.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +129 -24
  2. package/lib/agentTestCache.d.ts +4 -1
  3. package/lib/agentTestCache.js +2 -2
  4. package/lib/agentTestCache.js.map +1 -1
  5. package/lib/commands/agent/test/list.js +6 -1
  6. package/lib/commands/agent/test/list.js.map +1 -1
  7. package/lib/commands/agent/test/results.d.ts +3 -2
  8. package/lib/commands/agent/test/results.js +5 -3
  9. package/lib/commands/agent/test/results.js.map +1 -1
  10. package/lib/commands/agent/test/resume.d.ts +1 -0
  11. package/lib/commands/agent/test/resume.js +12 -4
  12. package/lib/commands/agent/test/resume.js.map +1 -1
  13. package/lib/commands/agent/test/run-eval.d.ts +1 -5
  14. package/lib/commands/agent/test/run-eval.js +54 -149
  15. package/lib/commands/agent/test/run-eval.js.map +1 -1
  16. package/lib/commands/agent/test/run.d.ts +1 -0
  17. package/lib/commands/agent/test/run.js +21 -8
  18. package/lib/commands/agent/test/run.js.map +1 -1
  19. package/lib/flags.d.ts +6 -1
  20. package/lib/flags.js +21 -4
  21. package/lib/flags.js.map +1 -1
  22. package/lib/handleTestResults.d.ts +4 -2
  23. package/lib/handleTestResults.js +137 -5
  24. package/lib/handleTestResults.js.map +1 -1
  25. package/lib/testRunnerFactory.d.ts +7 -0
  26. package/lib/testRunnerFactory.js +30 -0
  27. package/lib/testRunnerFactory.js.map +1 -0
  28. package/lib/testStages.d.ts +4 -3
  29. package/lib/testStages.js.map +1 -1
  30. package/messages/agent.test.list.md +1 -1
  31. package/messages/agent.test.run-eval.md +0 -4
  32. package/messages/shared.md +8 -0
  33. package/oclif.manifest.json +506 -481
  34. package/package.json +5 -5
  35. package/schemas/agent-activate.json +5 -2
  36. package/schemas/agent-create.json +39 -8
  37. package/schemas/agent-deactivate.json +5 -2
  38. package/schemas/agent-generate-agent__spec.json +18 -4
  39. package/schemas/agent-generate-authoring__bundle.json +6 -2
  40. package/schemas/agent-generate-template.json +5 -2
  41. package/schemas/agent-preview-end.json +5 -2
  42. package/schemas/agent-preview-send.json +6 -2
  43. package/schemas/agent-preview-sessions.json +10 -3
  44. package/schemas/agent-preview-start.json +5 -2
  45. package/schemas/agent-preview.json +1 -1
  46. package/schemas/agent-test-create.json +5 -2
  47. package/schemas/agent-test-list.json +1 -1
  48. package/schemas/agent-test-results.json +111 -10
  49. package/schemas/agent-test-resume.json +113 -10
  50. package/schemas/agent-test-run.json +113 -10
  51. package/schemas/agent-test-run__eval.json +17 -4
  52. package/schemas/agent-validate-authoring__bundle.json +4 -2
  53. package/lib/evalFormatter.d.ts +0 -30
  54. package/lib/evalFormatter.js +0 -263
  55. package/lib/evalFormatter.js.map +0 -1
  56. package/lib/evalNormalizer.d.ts +0 -57
  57. package/lib/evalNormalizer.js +0 -431
  58. package/lib/evalNormalizer.js.map +0 -1
  59. package/lib/yamlSpecTranslator.d.ts +0 -20
  60. package/lib/yamlSpecTranslator.js +0 -227
  61. package/lib/yamlSpecTranslator.js.map +0 -1
@@ -1003,14 +1003,14 @@
1003
1003
  "authoring-bundle:publish:agent"
1004
1004
  ]
1005
1005
  },
1006
- "agent:preview:end": {
1006
+ "agent:test:create": {
1007
1007
  "aliases": [],
1008
1008
  "args": {},
1009
- "description": "You must have previously started a programmatic agent preview session with the \"agent preview start\" command to then use this command to end it. This command also displays the local directory where the session trace files are stored.\n\nThe original \"agent preview start\" command outputs a session ID which you then use with the --session-id flag of this command to end the session. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the \"aiAuthoringBundles\" metadata directory. Similarly, the published agent's API name is the same as its directory name under the \"Bots\" metadata directory.",
1009
+ "description": "To run this command, you must have an agent test spec file, which is a YAML file that lists the test cases for testing a specific agent. Use the \"agent generate test-spec\" CLI command to generate a test spec file. Then specify the file to this command with the --spec flag, or run this command with no flags to be prompted.\n\nWhen this command completes, your org contains the new agent test, which you can view and edit using the Testing Center UI. This command also retrieves the metadata component (AiEvaluationDefinition) associated with the new test to your local Salesforce DX project and displays its filename.\n\nAfter you've created the test in the org, use the \"agent test run\" command to run it.",
1010
1010
  "examples": [
1011
- "End a preview session of a published agent by specifying its session ID and API name ; use the default org:\n<%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --api-name My_Published_Agent",
1012
- "Similar to previous example, but don't specify a session ID; you get an error if the published agent has more than one active session. Use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --api-name My_Published_Agent --target-org my-dev-org",
1013
- "End a preview session of an agent using its authoring bundle API name; you get an error if the agent has more than one active session.\n<%= config.bin %> <%= command.id %> --authoring-bundle My_Local_Agent"
1011
+ "Create an agent test interactively and be prompted for the test spec and API name of the test in the org; use the default org:\n<%= config.bin %> <%= command.id %>",
1012
+ "Create an agent test and use flags to specify all required information; if a test with same API name already exists in the org, overwrite it without confirmation. Use the org with alias \"my-org\":\n<%= config.bin %> <%= command.id %> --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --force-overwrite --target-org my-org",
1013
+ "Preview what the agent test metadata (AiEvaluationDefinition) looks like without deploying it to your default org:\n<%= config.bin %> <%= command.id %> --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --preview"
1014
1014
  ],
1015
1015
  "flags": {
1016
1016
  "json": {
@@ -1028,6 +1028,20 @@
1028
1028
  "multiple": false,
1029
1029
  "type": "option"
1030
1030
  },
1031
+ "api-name": {
1032
+ "name": "api-name",
1033
+ "summary": "API name of the new test; the API name must not exist in the org.",
1034
+ "hasDynamicHelp": false,
1035
+ "multiple": false,
1036
+ "type": "option"
1037
+ },
1038
+ "spec": {
1039
+ "name": "spec",
1040
+ "summary": "Path to the test spec YAML file.",
1041
+ "hasDynamicHelp": false,
1042
+ "multiple": false,
1043
+ "type": "option"
1044
+ },
1031
1045
  "target-org": {
1032
1046
  "char": "o",
1033
1047
  "name": "target-org",
@@ -1045,40 +1059,28 @@
1045
1059
  "multiple": false,
1046
1060
  "type": "option"
1047
1061
  },
1048
- "session-id": {
1049
- "name": "session-id",
1050
- "required": false,
1051
- "summary": "Session ID outputted by \"agent preview start\". Not required when the agent has exactly one active session. Run \"agent preview sessions\" to see the list of all sessions.",
1052
- "hasDynamicHelp": false,
1053
- "multiple": false,
1054
- "type": "option"
1055
- },
1056
- "api-name": {
1057
- "char": "n",
1058
- "name": "api-name",
1059
- "summary": "API name of the activated published agent you want to preview.",
1060
- "hasDynamicHelp": false,
1061
- "multiple": false,
1062
- "type": "option"
1062
+ "preview": {
1063
+ "name": "preview",
1064
+ "summary": "Preview the test metadata file (AiEvaluationDefinition) without deploying to your org.",
1065
+ "allowNo": false,
1066
+ "type": "boolean"
1063
1067
  },
1064
- "authoring-bundle": {
1065
- "name": "authoring-bundle",
1066
- "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
1067
- "hasDynamicHelp": false,
1068
- "multiple": false,
1069
- "type": "option"
1068
+ "force-overwrite": {
1069
+ "name": "force-overwrite",
1070
+ "summary": "Don't prompt for confirmation when overwriting an existing test (based on API name) in your org.",
1071
+ "allowNo": false,
1072
+ "type": "boolean"
1070
1073
  }
1071
1074
  },
1072
1075
  "hasDynamicHelp": true,
1073
1076
  "hiddenAliases": [],
1074
- "id": "agent:preview:end",
1077
+ "id": "agent:test:create",
1075
1078
  "pluginAlias": "@salesforce/plugin-agent",
1076
1079
  "pluginName": "@salesforce/plugin-agent",
1077
1080
  "pluginType": "core",
1078
1081
  "strict": true,
1079
- "summary": "End an existing programmatic agent preview session and get trace location.",
1082
+ "summary": "Create an agent test in your org using a local test spec YAML file.",
1080
1083
  "enableJsonFlag": true,
1081
- "requiresProject": true,
1082
1084
  "envVariablesSection": {
1083
1085
  "header": "ENVIRONMENT VARIABLES",
1084
1086
  "body": [
@@ -1093,19 +1095,19 @@
1093
1095
  "body": [
1094
1096
  {
1095
1097
  "name": "Succeeded (0)",
1096
- "description": "Preview session ended successfully and traces saved."
1098
+ "description": "Test created and deployed successfully."
1097
1099
  },
1098
1100
  {
1099
- "name": "NotFound (2)",
1100
- "description": "Agent not found, or no preview session exists for this agent."
1101
+ "name": "Failed (1)",
1102
+ "description": "Test validation errors or metadata format issues."
1101
1103
  },
1102
1104
  {
1103
- "name": "PreviewEndFailed (4)",
1104
- "description": "Failed to end the preview session."
1105
+ "name": "NotFound (2)",
1106
+ "description": "Test spec file not found or org connection failed."
1105
1107
  },
1106
1108
  {
1107
- "name": "SessionAmbiguous (5)",
1108
- "description": "Multiple preview sessions found; specify --session-id to choose one."
1109
+ "name": "DeploymentFailed (4)",
1110
+ "description": "Deployment failed due to API or network errors."
1109
1111
  }
1110
1112
  ]
1111
1113
  },
@@ -1114,27 +1116,26 @@
1114
1116
  "lib",
1115
1117
  "commands",
1116
1118
  "agent",
1117
- "preview",
1118
- "end.js"
1119
+ "test",
1120
+ "create.js"
1119
1121
  ],
1120
1122
  "aliasPermutations": [],
1121
1123
  "permutations": [
1122
- "agent:preview:end",
1123
- "preview:agent:end",
1124
- "preview:end:agent",
1125
- "agent:end:preview",
1126
- "end:agent:preview",
1127
- "end:preview:agent"
1124
+ "agent:test:create",
1125
+ "test:agent:create",
1126
+ "test:create:agent",
1127
+ "agent:create:test",
1128
+ "create:agent:test",
1129
+ "create:test:agent"
1128
1130
  ]
1129
1131
  },
1130
- "agent:preview:send": {
1132
+ "agent:test:list": {
1131
1133
  "aliases": [],
1132
1134
  "args": {},
1133
- "description": "You must have previously started a programmatic agent preview session with the \"agent preview start\" command to then use this command to send the agent a message (utterance). This command then displays the agent's response.\n\nThe original \"agent preview start\" command outputs a session ID which you then use with the --session-id flag of this command to send a message. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the \"aiAuthoringBundles\" metadata directory. Similarly, the published agent's API name is the same as its directory name under the \"Bots\" metadata directory.",
1135
+ "description": "The command outputs a table with the name (API name) of each test along with its unique ID, type ('agentforce-studio' or 'testing-center'), and the date it was created in the org.",
1134
1136
  "examples": [
1135
- "Send a message to an activated published agent using its API name and session ID; use the default org:\n<%= config.bin %> <%= command.id %> --utterance \"What can you help me with?\" --api-name My_Published_Agent --session-id <SESSION_ID>",
1136
- "Similar to previous example, but don't specify a session ID; you get an error if the agent has more than one active session. Use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --utterance \"What can you help me with?\" --api-name My_Published_Agent --target-org my-dev-org",
1137
- "Send a message to an agent using its authoring bundle API name; you get an error if the agent has more than one active session:\n<%= config.bin %> <%= command.id %> --utterance \"what can you help me with?\" --authoring-bundle My_Local_Agent"
1137
+ "List the agent tests in your default org:\n<%= config.bin %> <%= command.id %>",
1138
+ "List the agent tests in an org with alias \"my-org\"\"\n<%= config.bin %> <%= command.id %> --target-org my-org"
1138
1139
  ],
1139
1140
  "flags": {
1140
1141
  "json": {
@@ -1168,50 +1169,17 @@
1168
1169
  "hasDynamicHelp": false,
1169
1170
  "multiple": false,
1170
1171
  "type": "option"
1171
- },
1172
- "session-id": {
1173
- "name": "session-id",
1174
- "required": false,
1175
- "summary": "Session ID outputted by \"agent preview start\". Not required when the agent has exactly one active session. Run \"agent preview sessions\" to see list of all sessions.",
1176
- "hasDynamicHelp": false,
1177
- "multiple": false,
1178
- "type": "option"
1179
- },
1180
- "utterance": {
1181
- "char": "u",
1182
- "name": "utterance",
1183
- "required": true,
1184
- "summary": "Utterance to send to the agent, enclosed in double quotes.",
1185
- "hasDynamicHelp": false,
1186
- "multiple": false,
1187
- "type": "option"
1188
- },
1189
- "api-name": {
1190
- "char": "n",
1191
- "name": "api-name",
1192
- "summary": "API name of the activated published agent you want to preview.",
1193
- "hasDynamicHelp": false,
1194
- "multiple": false,
1195
- "type": "option"
1196
- },
1197
- "authoring-bundle": {
1198
- "name": "authoring-bundle",
1199
- "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
1200
- "hasDynamicHelp": false,
1201
- "multiple": false,
1202
- "type": "option"
1203
1172
  }
1204
1173
  },
1205
1174
  "hasDynamicHelp": true,
1206
1175
  "hiddenAliases": [],
1207
- "id": "agent:preview:send",
1176
+ "id": "agent:test:list",
1208
1177
  "pluginAlias": "@salesforce/plugin-agent",
1209
1178
  "pluginName": "@salesforce/plugin-agent",
1210
1179
  "pluginType": "core",
1211
1180
  "strict": true,
1212
- "summary": "Send a message to an existing agent preview session.",
1181
+ "summary": "List the available agent tests in your org.",
1213
1182
  "enableJsonFlag": true,
1214
- "requiresProject": true,
1215
1183
  "envVariablesSection": {
1216
1184
  "header": "ENVIRONMENT VARIABLES",
1217
1185
  "body": [
@@ -1226,80 +1194,11 @@
1226
1194
  "body": [
1227
1195
  {
1228
1196
  "name": "Succeeded (0)",
1229
- "description": "Message sent successfully and agent response received."
1230
- },
1231
- {
1232
- "name": "NotFound (2)",
1233
- "description": "Agent not found, or no preview session exists for this agent."
1234
- },
1235
- {
1236
- "name": "PreviewSendFailed (4)",
1237
- "description": "Failed to send message or receive response from the preview session."
1197
+ "description": "Agent tests listed successfully."
1238
1198
  },
1239
1199
  {
1240
- "name": "SessionAmbiguous (5)",
1241
- "description": "Multiple preview sessions found; specify --session-id to choose one."
1242
- }
1243
- ]
1244
- },
1245
- "isESM": true,
1246
- "relativePath": [
1247
- "lib",
1248
- "commands",
1249
- "agent",
1250
- "preview",
1251
- "send.js"
1252
- ],
1253
- "aliasPermutations": [],
1254
- "permutations": [
1255
- "agent:preview:send",
1256
- "preview:agent:send",
1257
- "preview:send:agent",
1258
- "agent:send:preview",
1259
- "send:agent:preview",
1260
- "send:preview:agent"
1261
- ]
1262
- },
1263
- "agent:preview:sessions": {
1264
- "aliases": [],
1265
- "args": {},
1266
- "description": "This command lists the agent preview sessions that were started with the \"agent preview start\" command and are still in the local cache. Use this command to discover specific session IDs that you can pass to the \"agent preview send\" or \"agent preview end\" commands with the --session-id flag.\n\nProgrammatic agent preview sessions can be started for both published activated agents and by using an agent's local authoring bundle, which contains its Agent Script file. In this command's output table, the Agent column contains either the API name of the authoring bundle or the published agent, whichever was used when starting the session. In the table, if the same API name has multiple rows with different session IDs, then it means that you previously started multiple preview sessions with the associated agent.",
1267
- "examples": [
1268
- "List all cached agent preview sessions:\n<%= config.bin %> <%= command.id %>"
1269
- ],
1270
- "flags": {
1271
- "json": {
1272
- "description": "Format output as json.",
1273
- "helpGroup": "GLOBAL",
1274
- "name": "json",
1275
- "allowNo": false,
1276
- "type": "boolean"
1277
- },
1278
- "flags-dir": {
1279
- "helpGroup": "GLOBAL",
1280
- "name": "flags-dir",
1281
- "summary": "Import flag values from a directory.",
1282
- "hasDynamicHelp": false,
1283
- "multiple": false,
1284
- "type": "option"
1285
- }
1286
- },
1287
- "hasDynamicHelp": false,
1288
- "hiddenAliases": [],
1289
- "id": "agent:preview:sessions",
1290
- "pluginAlias": "@salesforce/plugin-agent",
1291
- "pluginName": "@salesforce/plugin-agent",
1292
- "pluginType": "core",
1293
- "strict": true,
1294
- "summary": "List all known programmatic agent preview sessions.",
1295
- "enableJsonFlag": true,
1296
- "requiresProject": true,
1297
- "errorCodes": {
1298
- "header": "ERROR CODES",
1299
- "body": [
1300
- {
1301
- "name": "Succeeded (0)",
1302
- "description": "Sessions listed successfully (or empty list if no active sessions)."
1200
+ "name": "Failed (4)",
1201
+ "description": "Failed to retrieve agent tests due to API or network errors."
1303
1202
  }
1304
1203
  ]
1305
1204
  },
@@ -1308,27 +1207,27 @@
1308
1207
  "lib",
1309
1208
  "commands",
1310
1209
  "agent",
1311
- "preview",
1312
- "sessions.js"
1210
+ "test",
1211
+ "list.js"
1313
1212
  ],
1314
1213
  "aliasPermutations": [],
1315
1214
  "permutations": [
1316
- "agent:preview:sessions",
1317
- "preview:agent:sessions",
1318
- "preview:sessions:agent",
1319
- "agent:sessions:preview",
1320
- "sessions:agent:preview",
1321
- "sessions:preview:agent"
1215
+ "agent:test:list",
1216
+ "test:agent:list",
1217
+ "test:list:agent",
1218
+ "agent:list:test",
1219
+ "list:agent:test",
1220
+ "list:test:agent"
1322
1221
  ]
1323
1222
  },
1324
- "agent:preview:start": {
1223
+ "agent:test:results": {
1325
1224
  "aliases": [],
1326
1225
  "args": {},
1327
- "description": "This command outputs a session ID that you then use with the \"agent preview send\" command to send an utterance to the agent. Use the \"agent preview sessions\" command to list all active sessions and the \"agent preview end\" command to end a specific session.\n\nIdentify the agent you want to start previewing with either the --authoring-bundle flag to specify a local authoring bundle's API name or --api-name to specify an activated published agent's API name. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the \"aiAuthoringBundles\" metadata directory. Similarly, the published agent's API name is the same as its directory name under the \"Bots\" metadata directory.\n\nWhen starting a preview session with --authoring-bundle, you must explicitly specify the execution mode using one of these flags:\n\n- --use-live-actions: Executes real Apex classes, flows, and other actions in the org. This surfaces compile and validation errors during preview.\n- --simulate-actions: Uses AI to simulate action execution without calling real implementations.\n\nPublished agents (--api-name) always use live actions. The mode flags are optional and have no effect for published agents.",
1226
+ "description": "This command requires a job ID, which the original \"agent test run\" command displays when it completes. You can also use the --use-most-recent flag to see results for the most recently run agent test.\n\nBy default, this command outputs test results in human-readable tables for each test case. The tables show whether the test case passed, the expected and actual values, the test score, how long the test took, and more. Use the --result-format to display the test results in JSON or Junit format. Use the --output-dir flag to write the results to a file rather than to the terminal.",
1328
1227
  "examples": [
1329
- "Start a programmatic agent preview session by specifying an authoring bundle; use simulated actions. Use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --authoring-bundle My_Agent_Bundle --target-org my-dev-org --simulate-actions",
1330
- "Similar to previous example but use live actions and the default org:\n<%= config.bin %> <%= command.id %> --authoring-bundle My_Agent_Bundle --use-live-actions",
1331
- "Start a preview session with an activated published agent (always uses live actions):\n<%= config.bin %> <%= command.id %> --api-name My_Published_Agent"
1228
+ "Get the results of an agent test run in your default org using its job ID:\n<%= config.bin %> <%= command.id %> --job-id 4KBfake0000003F4AQ",
1229
+ "Get the results of the most recently run agent test in an org with alias \"my-org\":\n<%= config.bin %> <%= command.id %> --use-most-recent --target-org my-org",
1230
+ "Get the results of the most recently run agent test in your default org, and write the JSON-formatted results into a directory called \"test-results\":\n<%= config.bin %> <%= command.id %> --use-most-recent --output-dir ./test-results --result-format json"
1332
1231
  ],
1333
1232
  "flags": {
1334
1233
  "json": {
@@ -1363,61 +1262,67 @@
1363
1262
  "multiple": false,
1364
1263
  "type": "option"
1365
1264
  },
1366
- "api-name": {
1367
- "char": "n",
1368
- "name": "api-name",
1369
- "summary": "API name of the activated published agent you want to preview.",
1265
+ "job-id": {
1266
+ "char": "i",
1267
+ "name": "job-id",
1268
+ "required": true,
1269
+ "summary": "Job ID of the completed agent test run.",
1370
1270
  "hasDynamicHelp": false,
1371
1271
  "multiple": false,
1372
1272
  "type": "option"
1373
1273
  },
1374
- "authoring-bundle": {
1375
- "name": "authoring-bundle",
1376
- "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
1274
+ "result-format": {
1275
+ "name": "result-format",
1276
+ "summary": "Format of the agent test run results.",
1277
+ "default": "human",
1377
1278
  "hasDynamicHelp": false,
1378
1279
  "multiple": false,
1379
- "type": "option"
1380
- },
1381
- "use-live-actions": {
1382
- "exclusive": [
1383
- "simulate-actions"
1280
+ "options": [
1281
+ "json",
1282
+ "human",
1283
+ "junit",
1284
+ "tap"
1384
1285
  ],
1385
- "name": "use-live-actions",
1386
- "summary": "Execute real actions in the org (Apex classes, flows, etc.). Required with --authoring-bundle.",
1387
- "allowNo": false,
1388
- "type": "boolean"
1286
+ "type": "option"
1389
1287
  },
1390
- "simulate-actions": {
1391
- "exclusive": [
1392
- "use-live-actions"
1393
- ],
1394
- "name": "simulate-actions",
1395
- "summary": "Use AI to simulate action execution instead of calling real actions. Required with --authoring-bundle.",
1396
- "allowNo": false,
1397
- "type": "boolean"
1288
+ "output-dir": {
1289
+ "char": "d",
1290
+ "description": "If the agent test run completes, write the results to the specified directory. If the test is still running, the test results aren't written.",
1291
+ "name": "output-dir",
1292
+ "summary": "Directory to write the agent test results into.",
1293
+ "hasDynamicHelp": false,
1294
+ "multiple": false,
1295
+ "type": "option"
1398
1296
  },
1399
- "agent-json": {
1400
- "dependsOn": [
1401
- "authoring-bundle"
1402
- ],
1403
- "hidden": true,
1404
- "name": "agent-json",
1405
- "summary": "Path to a pre-compiled AgentJSON file to use instead of compiling the Agent Script file. Intended for internal use and testing.",
1297
+ "test-runner": {
1298
+ "description": "By default, the command automatically detects which test runner to use based on the test definition metadata type in your org. Use this flag to explicitly specify the runner type. 'agentforce-studio' uses AiTestingDefinition metadata. 'testing-center' uses AiEvaluationDefinition metadata.",
1299
+ "name": "test-runner",
1300
+ "summary": "Explicitly specify which test runner to use (agentforce-studio or testing-center).",
1406
1301
  "hasDynamicHelp": false,
1407
1302
  "multiple": false,
1303
+ "options": [
1304
+ "agentforce-studio",
1305
+ "testing-center"
1306
+ ],
1408
1307
  "type": "option"
1308
+ },
1309
+ "verbose": {
1310
+ "description": "When enabled, includes detailed generated data (such as invoked actions) in the human-readable test results output. This is useful for debugging test failures and understanding what actions were actually invoked during the test run.\n\nThe generated data is in JSON format and includes the Apex classes or Flows that were invoked, the Salesforce objects that were touched, and so on. Use the JSON structure of this information to build the test case JSONPath expression when using custom evaluations.",
1311
+ "name": "verbose",
1312
+ "summary": "Show generated data in the test results output.",
1313
+ "allowNo": false,
1314
+ "type": "boolean"
1409
1315
  }
1410
1316
  },
1411
1317
  "hasDynamicHelp": true,
1412
1318
  "hiddenAliases": [],
1413
- "id": "agent:preview:start",
1319
+ "id": "agent:test:results",
1414
1320
  "pluginAlias": "@salesforce/plugin-agent",
1415
1321
  "pluginName": "@salesforce/plugin-agent",
1416
1322
  "pluginType": "core",
1417
1323
  "strict": true,
1418
- "summary": "Start a programmatic agent preview session.",
1324
+ "summary": "Get the results of a completed agent test run.",
1419
1325
  "enableJsonFlag": true,
1420
- "requiresProject": true,
1421
1326
  "envVariablesSection": {
1422
1327
  "header": "ENVIRONMENT VARIABLES",
1423
1328
  "body": [
@@ -1432,23 +1337,15 @@
1432
1337
  "body": [
1433
1338
  {
1434
1339
  "name": "Succeeded (0)",
1435
- "description": "Preview session started successfully."
1436
- },
1437
- {
1438
- "name": "Failed (1)",
1439
- "description": "Agent Script compilation failed (syntax errors in the script)."
1340
+ "description": "Results retrieved successfully. Test results (passed/failed) are in the output."
1440
1341
  },
1441
1342
  {
1442
1343
  "name": "NotFound (2)",
1443
- "description": "Agent not found, or compilation API returned HTTP 404 (endpoint may not be available in your org or region)."
1444
- },
1445
- {
1446
- "name": "ServerError (3)",
1447
- "description": "Compilation API returned HTTP 500 (server error during compilation)."
1344
+ "description": "Job ID not found or invalid."
1448
1345
  },
1449
1346
  {
1450
- "name": "PreviewStartFailed (4)",
1451
- "description": "Preview session failed to start due to API or network errors."
1347
+ "name": "Failed (4)",
1348
+ "description": "Failed to retrieve results due to API or network errors."
1452
1349
  }
1453
1350
  ]
1454
1351
  },
@@ -1457,27 +1354,27 @@
1457
1354
  "lib",
1458
1355
  "commands",
1459
1356
  "agent",
1460
- "preview",
1461
- "start.js"
1357
+ "test",
1358
+ "results.js"
1462
1359
  ],
1463
1360
  "aliasPermutations": [],
1464
1361
  "permutations": [
1465
- "agent:preview:start",
1466
- "preview:agent:start",
1467
- "preview:start:agent",
1468
- "agent:start:preview",
1469
- "start:agent:preview",
1470
- "start:preview:agent"
1362
+ "agent:test:results",
1363
+ "test:agent:results",
1364
+ "test:results:agent",
1365
+ "agent:results:test",
1366
+ "results:agent:test",
1367
+ "results:test:agent"
1471
1368
  ]
1472
1369
  },
1473
- "agent:test:create": {
1370
+ "agent:test:resume": {
1474
1371
  "aliases": [],
1475
1372
  "args": {},
1476
- "description": "To run this command, you must have an agent test spec file, which is a YAML file that lists the test cases for testing a specific agent. Use the \"agent generate test-spec\" CLI command to generate a test spec file. Then specify the file to this command with the --spec flag, or run this command with no flags to be prompted.\n\nWhen this command completes, your org contains the new agent test, which you can view and edit using the Testing Center UI. This command also retrieves the metadata component (AiEvaluationDefinition) associated with the new test to your local Salesforce DX project and displays its filename.\n\nAfter you've created the test in the org, use the \"agent test run\" command to run it.",
1373
+ "description": "This command requires a job ID, which the original \"agent test run\" command displays when it completes. You can also use the --use-most-recent flag to see results for the most recently run agent test.\n\nUse the --wait flag to specify the number of minutes for this command to wait for the agent test to complete; if the test completes by the end of the wait time, the command displays the test results. If not, the CLI returns control of the terminal to you, and you must run \"agent test resume\" again.\n\nBy default, this command outputs test results in human-readable tables for each test case. The tables show whether the test case passed, the expected and actual values, the test score, how long the test took, and more. Use the --result-format to display the test results in JSON or Junit format. Use the --output-dir flag to write the results to a file rather than to the terminal.",
1477
1374
  "examples": [
1478
- "Create an agent test interactively and be prompted for the test spec and API name of the test in the org; use the default org:\n<%= config.bin %> <%= command.id %>",
1479
- "Create an agent test and use flags to specify all required information; if a test with same API name already exists in the org, overwrite it without confirmation. Use the org with alias \"my-org\":\n<%= config.bin %> <%= command.id %> --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --force-overwrite --target-org my-org",
1480
- "Preview what the agent test metadata (AiEvaluationDefinition) looks like without deploying it to your default org:\n<%= config.bin %> <%= command.id %> --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --preview"
1375
+ "Resume an agent test in your default org using a job ID:\n<%= config.bin %> <%= command.id %> --job-id 4KBfake0000003F4AQ",
1376
+ "Resume the most recently-run agent test in an org with alias \"my-org\" org; wait 10 minutes for the tests to finish:\n<%= config.bin %> <%= command.id %> --use-most-recent --wait 10 --target-org my-org",
1377
+ "Resume the most recent agent test in your default org, and write the JSON-formatted results into a directory called \"test-results\":\n<%= config.bin %> <%= command.id %> --use-most-recent --output-dir ./test-results --result-format json"
1481
1378
  ],
1482
1379
  "flags": {
1483
1380
  "json": {
@@ -1495,20 +1392,6 @@
1495
1392
  "multiple": false,
1496
1393
  "type": "option"
1497
1394
  },
1498
- "api-name": {
1499
- "name": "api-name",
1500
- "summary": "API name of the new test; the API name must not exist in the org.",
1501
- "hasDynamicHelp": false,
1502
- "multiple": false,
1503
- "type": "option"
1504
- },
1505
- "spec": {
1506
- "name": "spec",
1507
- "summary": "Path to the test spec YAML file.",
1508
- "hasDynamicHelp": false,
1509
- "multiple": false,
1510
- "type": "option"
1511
- },
1512
1395
  "target-org": {
1513
1396
  "char": "o",
1514
1397
  "name": "target-org",
@@ -1526,27 +1409,81 @@
1526
1409
  "multiple": false,
1527
1410
  "type": "option"
1528
1411
  },
1529
- "preview": {
1530
- "name": "preview",
1531
- "summary": "Preview the test metadata file (AiEvaluationDefinition) without deploying to your org.",
1412
+ "job-id": {
1413
+ "char": "i",
1414
+ "name": "job-id",
1415
+ "summary": "Job ID of the original agent test run.",
1416
+ "hasDynamicHelp": false,
1417
+ "multiple": false,
1418
+ "type": "option"
1419
+ },
1420
+ "use-most-recent": {
1421
+ "char": "r",
1422
+ "name": "use-most-recent",
1423
+ "summary": "Use the job ID of the most recent agent test run.",
1532
1424
  "allowNo": false,
1533
1425
  "type": "boolean"
1534
1426
  },
1535
- "force-overwrite": {
1536
- "name": "force-overwrite",
1537
- "summary": "Don't prompt for confirmation when overwriting an existing test (based on API name) in your org.",
1427
+ "wait": {
1428
+ "char": "w",
1429
+ "name": "wait",
1430
+ "summary": "Number of minutes to wait for the command to complete and display results to the terminal window.",
1431
+ "default": "5 minutes",
1432
+ "hasDynamicHelp": true,
1433
+ "multiple": false,
1434
+ "type": "option"
1435
+ },
1436
+ "result-format": {
1437
+ "name": "result-format",
1438
+ "summary": "Format of the agent test run results.",
1439
+ "default": "human",
1440
+ "hasDynamicHelp": false,
1441
+ "multiple": false,
1442
+ "options": [
1443
+ "json",
1444
+ "human",
1445
+ "junit",
1446
+ "tap"
1447
+ ],
1448
+ "type": "option"
1449
+ },
1450
+ "output-dir": {
1451
+ "char": "d",
1452
+ "description": "If the agent test run completes, write the results to the specified directory. If the test is still running, the test results aren't written.",
1453
+ "name": "output-dir",
1454
+ "summary": "Directory to write the agent test results into.",
1455
+ "hasDynamicHelp": false,
1456
+ "multiple": false,
1457
+ "type": "option"
1458
+ },
1459
+ "test-runner": {
1460
+ "description": "By default, the command automatically detects which test runner to use based on the test definition metadata type in your org. Use this flag to explicitly specify the runner type. 'agentforce-studio' uses AiTestingDefinition metadata. 'testing-center' uses AiEvaluationDefinition metadata.",
1461
+ "name": "test-runner",
1462
+ "summary": "Explicitly specify which test runner to use (agentforce-studio or testing-center).",
1463
+ "hasDynamicHelp": false,
1464
+ "multiple": false,
1465
+ "options": [
1466
+ "agentforce-studio",
1467
+ "testing-center"
1468
+ ],
1469
+ "type": "option"
1470
+ },
1471
+ "verbose": {
1472
+ "description": "When enabled, includes detailed generated data (such as invoked actions) in the human-readable test results output. This is useful for debugging test failures and understanding what actions were actually invoked during the test run.\n\nThe generated data is in JSON format and includes the Apex classes or Flows that were invoked, the Salesforce objects that were touched, and so on. Use the JSON structure of this information to build the test case JSONPath expression when using custom evaluations.",
1473
+ "name": "verbose",
1474
+ "summary": "Show generated data in the test results output.",
1538
1475
  "allowNo": false,
1539
1476
  "type": "boolean"
1540
1477
  }
1541
1478
  },
1542
1479
  "hasDynamicHelp": true,
1543
1480
  "hiddenAliases": [],
1544
- "id": "agent:test:create",
1481
+ "id": "agent:test:resume",
1545
1482
  "pluginAlias": "@salesforce/plugin-agent",
1546
1483
  "pluginName": "@salesforce/plugin-agent",
1547
1484
  "pluginType": "core",
1548
1485
  "strict": true,
1549
- "summary": "Create an agent test in your org using a local test spec YAML file.",
1486
+ "summary": "Resume an agent test that you previously started in your org so you can view the test results.",
1550
1487
  "enableJsonFlag": true,
1551
1488
  "envVariablesSection": {
1552
1489
  "header": "ENVIRONMENT VARIABLES",
@@ -1562,19 +1499,19 @@
1562
1499
  "body": [
1563
1500
  {
1564
1501
  "name": "Succeeded (0)",
1565
- "description": "Test created and deployed successfully."
1502
+ "description": "Test completed successfully (with test results in the output)."
1566
1503
  },
1567
1504
  {
1568
1505
  "name": "Failed (1)",
1569
- "description": "Test validation errors or metadata format issues."
1506
+ "description": "Tests encountered execution errors (test cases with ERROR status)."
1570
1507
  },
1571
1508
  {
1572
1509
  "name": "NotFound (2)",
1573
- "description": "Test spec file not found or org connection failed."
1510
+ "description": "Job ID not found or invalid."
1574
1511
  },
1575
1512
  {
1576
- "name": "DeploymentFailed (4)",
1577
- "description": "Deployment failed due to API or network errors."
1513
+ "name": "OperationFailed (4)",
1514
+ "description": "Failed to poll test due to API or network errors."
1578
1515
  }
1579
1516
  ]
1580
1517
  },
@@ -1584,25 +1521,29 @@
1584
1521
  "commands",
1585
1522
  "agent",
1586
1523
  "test",
1587
- "create.js"
1524
+ "resume.js"
1588
1525
  ],
1589
1526
  "aliasPermutations": [],
1590
1527
  "permutations": [
1591
- "agent:test:create",
1592
- "test:agent:create",
1593
- "test:create:agent",
1594
- "agent:create:test",
1595
- "create:agent:test",
1596
- "create:test:agent"
1528
+ "agent:test:resume",
1529
+ "test:agent:resume",
1530
+ "test:resume:agent",
1531
+ "agent:resume:test",
1532
+ "resume:agent:test",
1533
+ "resume:test:agent"
1597
1534
  ]
1598
1535
  },
1599
- "agent:test:list": {
1536
+ "agent:test:run-eval": {
1600
1537
  "aliases": [],
1601
1538
  "args": {},
1602
- "description": "The command outputs a table with the name (API name) of each test along with its unique ID and the date it was created in the org.",
1539
+ "description": "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.\n\nWhen 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`. YAML test specs also support contextVariables, which allow you to inject contextual data (such as CaseId or RoutableId) into agent sessions for testing with different contexts.\n\nWhen 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. JSON payloads can also include context_variables on agent.create_session steps for the same contextual testing capabilities.\n\nSupports 8+ evaluator types, including topic routing assertions, action invocation checks, string/numeric assertions, semantic similarity scoring, and LLM-based quality ratings.",
1603
1540
  "examples": [
1604
- "List the agent tests in your default org:\n<%= config.bin %> <%= command.id %>",
1605
- "List the agent tests in an org with alias \"my-org\"\"\n<%= config.bin %> <%= command.id %> --target-org my-org"
1541
+ "Run tests using a YAML test spec on the org with alias \"my-org\":\n<%= config.bin %> <%= command.id %> --spec tests/my-agent-testSpec.yaml --target-org my-org",
1542
+ "Run tests using a YAML spec with explicit agent name override; use your default org:\n<%= config.bin %> <%= command.id %> --spec tests/my-agent-testSpec.yaml --api-name My_Agent --target-org my-org",
1543
+ "Run tests using a JSON payload:\n<%= config.bin %> <%= command.id %> --spec tests/eval-payload.json --target-org my-org",
1544
+ "Run tests and output results in JUnit format; useful for continuous integration and deployment (CI/CD):\n<%= config.bin %> <%= command.id %> --spec tests/my-agent-testSpec.yaml --target-org my-org --result-format junit",
1545
+ "Run tests with contextVariables to inject contextual data into agent sessions (add contextVariables to test cases in your YAML spec):\n<%= config.bin %> <%= command.id %> --spec tests/agent-with-context.yaml --target-org my-org",
1546
+ "Pipe JSON payload from stdin (--spec flag is automatically populated from stdin):\n$ echo '{\"tests\":[...]}' | <%= config.bin %> <%= command.id %> --spec --target-org my-org"
1606
1547
  ],
1607
1548
  "flags": {
1608
1549
  "json": {
@@ -1636,16 +1577,61 @@
1636
1577
  "hasDynamicHelp": false,
1637
1578
  "multiple": false,
1638
1579
  "type": "option"
1580
+ },
1581
+ "spec": {
1582
+ "char": "s",
1583
+ "name": "spec",
1584
+ "required": true,
1585
+ "summary": "Path to test spec file (YAML or JSON). Supports reading from stdin when piping content.",
1586
+ "hasDynamicHelp": false,
1587
+ "multiple": false,
1588
+ "type": "option"
1589
+ },
1590
+ "api-name": {
1591
+ "char": "n",
1592
+ "name": "api-name",
1593
+ "summary": "Agent DeveloperName (also called API name) to resolve agent_id and agent_version_id. Auto-inferred from the YAML spec's subjectName.",
1594
+ "hasDynamicHelp": false,
1595
+ "multiple": false,
1596
+ "type": "option"
1597
+ },
1598
+ "result-format": {
1599
+ "name": "result-format",
1600
+ "summary": "Format of the agent test run results.",
1601
+ "default": "human",
1602
+ "hasDynamicHelp": false,
1603
+ "multiple": false,
1604
+ "options": [
1605
+ "json",
1606
+ "human",
1607
+ "junit",
1608
+ "tap"
1609
+ ],
1610
+ "type": "option"
1611
+ },
1612
+ "batch-size": {
1613
+ "name": "batch-size",
1614
+ "summary": "Number of tests per API request (max 5).",
1615
+ "default": 5,
1616
+ "hasDynamicHelp": false,
1617
+ "multiple": false,
1618
+ "type": "option"
1619
+ },
1620
+ "no-normalize": {
1621
+ "name": "no-normalize",
1622
+ "summary": "Disable auto-normalization of field names and shorthand references.",
1623
+ "allowNo": false,
1624
+ "type": "boolean"
1639
1625
  }
1640
1626
  },
1641
1627
  "hasDynamicHelp": true,
1642
1628
  "hiddenAliases": [],
1643
- "id": "agent:test:list",
1629
+ "id": "agent:test:run-eval",
1644
1630
  "pluginAlias": "@salesforce/plugin-agent",
1645
1631
  "pluginName": "@salesforce/plugin-agent",
1646
1632
  "pluginType": "core",
1647
1633
  "strict": true,
1648
- "summary": "List the available agent tests in your org.",
1634
+ "summary": "Run evaluation tests against an Agentforce agent.",
1649
1635
  "enableJsonFlag": true,
1650
1636
  "envVariablesSection": {
1651
1637
  "header": "ENVIRONMENT VARIABLES",
@@ -1661,11 +1647,19 @@
1661
1647
  "body": [
1662
1648
  {
1663
1649
  "name": "Succeeded (0)",
1664
- "description": "Agent tests listed successfully."
1650
+ "description": "Tests completed successfully. Test results (passed/failed) are in the JSON output."
1665
1651
  },
1666
1652
  {
1667
- "name": "Failed (4)",
1668
- "description": "Failed to retrieve agent tests due to API or network errors."
1653
+ "name": "Failed (1)",
1654
+ "description": "Tests encountered execution errors (tests couldn't run properly)."
1655
+ },
1656
+ {
1657
+ "name": "NotFound (2)",
1658
+ "description": "Agent not found, spec file not found, or invalid agent name."
1659
+ },
1660
+ {
1661
+ "name": "OperationFailed (4)",
1662
+ "description": "Failed to execute tests due to API or network errors."
1669
1663
  }
1670
1664
  ]
1671
1665
  },
@@ -1675,26 +1669,26 @@
1675
1669
  "commands",
1676
1670
  "agent",
1677
1671
  "test",
1678
- "list.js"
1672
+ "run-eval.js"
1679
1673
  ],
1680
1674
  "aliasPermutations": [],
1681
1675
  "permutations": [
1682
- "agent:test:list",
1683
- "test:agent:list",
1684
- "test:list:agent",
1685
- "agent:list:test",
1686
- "list:agent:test",
1687
- "list:test:agent"
1676
+ "agent:test:run-eval",
1677
+ "test:agent:run-eval",
1678
+ "test:run-eval:agent",
1679
+ "agent:run-eval:test",
1680
+ "run-eval:agent:test",
1681
+ "run-eval:test:agent"
1688
1682
  ]
1689
1683
  },
1690
- "agent:test:results": {
1684
+ "agent:test:run": {
1691
1685
  "aliases": [],
1692
1686
  "args": {},
1693
- "description": "This command requires a job ID, which the original \"agent test run\" command displays when it completes. You can also use the --use-most-recent flag to see results for the most recently run agent test.\n\nBy default, this command outputs test results in human-readable tables for each test case. The tables show whether the test case passed, the expected and actual values, the test score, how long the test took, and more. Use the --result-format to display the test results in JSON or Junit format. Use the --output-dir flag to write the results to a file rather than to the terminal.",
1687
+ "description": "Use the --api-name flag to specify the name of the agent test you want to run. Use the output of the \"agent test list\" command to get the names of all the available agent tests in your org.\n\nBy default, this command starts the agent test in your org, but it doesn't wait for the test to finish. Instead, it displays the \"agent test resume\" command, with a job ID, that you execute to see the results of the test run, and then returns control of the terminal window to you. Use the --wait flag to specify the number of minutes for the command to wait for the agent test to complete; if the test completes by the end of the wait time, the command displays the test results. If not, run \"agent test resume\".\n\nBy default, this command outputs test results in human-readable tables for each test case, if the test completes in time. The tables show whether the test case passed, the expected and actual values, the test score, how long the test took, and more. Use the --result-format to display the test results in JSON or Junit format. Use the --output-dir flag to write the results to a file rather than to the terminal.",
1694
1688
  "examples": [
1695
- "Get the results of an agent test run in your default org using its job ID:\n<%= config.bin %> <%= command.id %> --job-id 4KBfake0000003F4AQ",
1696
- "Get the results of the most recently run agent test in an org with alias \"my-org\":\n<%= config.bin %> <%= command.id %> --use-most-recent --target-org my-org",
1697
- "Get the results of the most recently run agent test in your default org, and write the JSON-formatted results into a directory called \"test-results\":\n<%= config.bin %> <%= command.id %> --use-most-recent --output-dir ./test-results --result-format json"
1689
+ "Start an agent test called Resort_Manager_Test for an agent in your default org, don't wait for the test to finish:\n<%= config.bin %> <%= command.id %> --api-name Resort_Manager_Test",
1690
+ "Start an agent test for an agent in an org with alias \"my-org\" and wait for 10 minutes for the test to finish:\n<%= config.bin %> <%= command.id %> --api-name Resort_Manager_Test --wait 10 --target-org my-org",
1691
+ "Start an agent test and write the JSON-formatted results into a directory called \"test-results\":\n<%= config.bin %> <%= command.id %> --api-name Resort_Manager_Test --wait 10 --output-dir ./test-results --result-format json"
1698
1692
  ],
1699
1693
  "flags": {
1700
1694
  "json": {
@@ -1729,15 +1723,22 @@
1729
1723
  "multiple": false,
1730
1724
  "type": "option"
1731
1725
  },
1732
- "job-id": {
1733
- "char": "i",
1734
- "name": "job-id",
1735
- "required": true,
1736
- "summary": "Job ID of the completed agent test run.",
1726
+ "api-name": {
1727
+ "char": "n",
1728
+ "name": "api-name",
1729
+ "summary": "API name of the agent test to run; corresponds to the name of the AiEvaluationDefinition metadata component that implements the agent test.",
1737
1730
  "hasDynamicHelp": false,
1738
1731
  "multiple": false,
1739
1732
  "type": "option"
1740
1733
  },
1734
+ "wait": {
1735
+ "char": "w",
1736
+ "name": "wait",
1737
+ "summary": "Number of minutes to wait for the command to complete and display results to the terminal window.",
1738
+ "hasDynamicHelp": true,
1739
+ "multiple": false,
1740
+ "type": "option"
1741
+ },
1741
1742
  "result-format": {
1742
1743
  "name": "result-format",
1743
1744
  "summary": "Format of the agent test run results.",
@@ -1761,6 +1762,18 @@
1761
1762
  "multiple": false,
1762
1763
  "type": "option"
1763
1764
  },
1765
+ "test-runner": {
1766
+ "description": "By default, the command automatically detects which test runner to use based on the test definition metadata type in your org. Use this flag to explicitly specify the runner type. 'agentforce-studio' uses AiTestingDefinition metadata. 'testing-center' uses AiEvaluationDefinition metadata.",
1767
+ "name": "test-runner",
1768
+ "summary": "Explicitly specify which test runner to use (agentforce-studio or testing-center).",
1769
+ "hasDynamicHelp": false,
1770
+ "multiple": false,
1771
+ "options": [
1772
+ "agentforce-studio",
1773
+ "testing-center"
1774
+ ],
1775
+ "type": "option"
1776
+ },
1764
1777
  "verbose": {
1765
1778
  "description": "When enabled, includes detailed generated data (such as invoked actions) in the human-readable test results output. This is useful for debugging test failures and understanding what actions were actually invoked during the test run.\n\nThe generated data is in JSON format and includes the Apex classes or Flows that were invoked, the Salesforce objects that were touched, and so on. Use the JSON structure of this information to build the test case JSONPath expression when using custom evaluations.",
1766
1779
  "name": "verbose",
@@ -1771,12 +1784,12 @@
1771
1784
  },
1772
1785
  "hasDynamicHelp": true,
1773
1786
  "hiddenAliases": [],
1774
- "id": "agent:test:results",
1787
+ "id": "agent:test:run",
1775
1788
  "pluginAlias": "@salesforce/plugin-agent",
1776
1789
  "pluginName": "@salesforce/plugin-agent",
1777
1790
  "pluginType": "core",
1778
1791
  "strict": true,
1779
- "summary": "Get the results of a completed agent test run.",
1792
+ "summary": "Start an agent test in your org.",
1780
1793
  "enableJsonFlag": true,
1781
1794
  "envVariablesSection": {
1782
1795
  "header": "ENVIRONMENT VARIABLES",
@@ -1792,15 +1805,19 @@
1792
1805
  "body": [
1793
1806
  {
1794
1807
  "name": "Succeeded (0)",
1795
- "description": "Results retrieved successfully. Test results (passed/failed) are in the output."
1808
+ "description": "Test started successfully (without --wait), or test completed successfully (with --wait)."
1809
+ },
1810
+ {
1811
+ "name": "Failed (1)",
1812
+ "description": "Tests encountered execution errors (test cases with ERROR status when using --wait)."
1796
1813
  },
1797
1814
  {
1798
1815
  "name": "NotFound (2)",
1799
- "description": "Job ID not found or invalid."
1816
+ "description": "Test definition not found or invalid test name."
1800
1817
  },
1801
1818
  {
1802
- "name": "Failed (4)",
1803
- "description": "Failed to retrieve results due to API or network errors."
1819
+ "name": "OperationFailed (4)",
1820
+ "description": "Failed to start or poll test due to API or network errors."
1804
1821
  }
1805
1822
  ]
1806
1823
  },
@@ -1810,26 +1827,26 @@
1810
1827
  "commands",
1811
1828
  "agent",
1812
1829
  "test",
1813
- "results.js"
1830
+ "run.js"
1814
1831
  ],
1815
1832
  "aliasPermutations": [],
1816
1833
  "permutations": [
1817
- "agent:test:results",
1818
- "test:agent:results",
1819
- "test:results:agent",
1820
- "agent:results:test",
1821
- "results:agent:test",
1822
- "results:test:agent"
1834
+ "agent:test:run",
1835
+ "test:agent:run",
1836
+ "test:run:agent",
1837
+ "agent:run:test",
1838
+ "run:agent:test",
1839
+ "run:test:agent"
1823
1840
  ]
1824
1841
  },
1825
- "agent:test:resume": {
1842
+ "agent:preview:end": {
1826
1843
  "aliases": [],
1827
1844
  "args": {},
1828
- "description": "This command requires a job ID, which the original \"agent test run\" command displays when it completes. You can also use the --use-most-recent flag to see results for the most recently run agent test.\n\nUse the --wait flag to specify the number of minutes for this command to wait for the agent test to complete; if the test completes by the end of the wait time, the command displays the test results. If not, the CLI returns control of the terminal to you, and you must run \"agent test resume\" again.\n\nBy default, this command outputs test results in human-readable tables for each test case. The tables show whether the test case passed, the expected and actual values, the test score, how long the test took, and more. Use the --result-format to display the test results in JSON or Junit format. Use the --output-dir flag to write the results to a file rather than to the terminal.",
1845
+ "description": "You must have previously started a programmatic agent preview session with the \"agent preview start\" command to then use this command to end it. This command also displays the local directory where the session trace files are stored.\n\nThe original \"agent preview start\" command outputs a session ID which you then use with the --session-id flag of this command to end the session. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the \"aiAuthoringBundles\" metadata directory. Similarly, the published agent's API name is the same as its directory name under the \"Bots\" metadata directory.",
1829
1846
  "examples": [
1830
- "Resume an agent test in your default org using a job ID:\n<%= config.bin %> <%= command.id %> --job-id 4KBfake0000003F4AQ",
1831
- "Resume the most recently-run agent test in an org with alias \"my-org\" org; wait 10 minutes for the tests to finish:\n<%= config.bin %> <%= command.id %> --use-most-recent --wait 10 --target-org my-org",
1832
- "Resume the most recent agent test in your default org, and write the JSON-formatted results into a directory called \"test-results\":\n<%= config.bin %> <%= command.id %> --use-most-recent --output-dir ./test-results --result-format json"
1847
+ "End a preview session of a published agent by specifying its session ID and API name ; use the default org:\n<%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --api-name My_Published_Agent",
1848
+ "Similar to previous example, but don't specify a session ID; you get an error if the published agent has more than one active session. Use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --api-name My_Published_Agent --target-org my-dev-org",
1849
+ "End a preview session of an agent using its authoring bundle API name; you get an error if the agent has more than one active session.\n<%= config.bin %> <%= command.id %> --authoring-bundle My_Local_Agent"
1833
1850
  ],
1834
1851
  "flags": {
1835
1852
  "json": {
@@ -1864,70 +1881,40 @@
1864
1881
  "multiple": false,
1865
1882
  "type": "option"
1866
1883
  },
1867
- "job-id": {
1868
- "char": "i",
1869
- "name": "job-id",
1870
- "summary": "Job ID of the original agent test run.",
1884
+ "session-id": {
1885
+ "name": "session-id",
1886
+ "required": false,
1887
+ "summary": "Session ID outputted by \"agent preview start\". Not required when the agent has exactly one active session. Run \"agent preview sessions\" to see the list of all sessions.",
1871
1888
  "hasDynamicHelp": false,
1872
1889
  "multiple": false,
1873
1890
  "type": "option"
1874
1891
  },
1875
- "use-most-recent": {
1876
- "char": "r",
1877
- "name": "use-most-recent",
1878
- "summary": "Use the job ID of the most recent agent test run.",
1879
- "allowNo": false,
1880
- "type": "boolean"
1881
- },
1882
- "wait": {
1883
- "char": "w",
1884
- "name": "wait",
1885
- "summary": "Number of minutes to wait for the command to complete and display results to the terminal window.",
1886
- "default": "5 minutes",
1887
- "hasDynamicHelp": true,
1888
- "multiple": false,
1889
- "type": "option"
1890
- },
1891
- "result-format": {
1892
- "name": "result-format",
1893
- "summary": "Format of the agent test run results.",
1894
- "default": "human",
1892
+ "api-name": {
1893
+ "char": "n",
1894
+ "name": "api-name",
1895
+ "summary": "API name of the activated published agent you want to preview.",
1895
1896
  "hasDynamicHelp": false,
1896
1897
  "multiple": false,
1897
- "options": [
1898
- "json",
1899
- "human",
1900
- "junit",
1901
- "tap"
1902
- ],
1903
1898
  "type": "option"
1904
1899
  },
1905
- "output-dir": {
1906
- "char": "d",
1907
- "description": "If the agent test run completes, write the results to the specified directory. If the test is still running, the test results aren't written.",
1908
- "name": "output-dir",
1909
- "summary": "Directory to write the agent test results into.",
1900
+ "authoring-bundle": {
1901
+ "name": "authoring-bundle",
1902
+ "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
1910
1903
  "hasDynamicHelp": false,
1911
1904
  "multiple": false,
1912
1905
  "type": "option"
1913
- },
1914
- "verbose": {
1915
- "description": "When enabled, includes detailed generated data (such as invoked actions) in the human-readable test results output. This is useful for debugging test failures and understanding what actions were actually invoked during the test run.\n\nThe generated data is in JSON format and includes the Apex classes or Flows that were invoked, the Salesforce objects that were touched, and so on. Use the JSON structure of this information to build the test case JSONPath expression when using custom evaluations.",
1916
- "name": "verbose",
1917
- "summary": "Show generated data in the test results output.",
1918
- "allowNo": false,
1919
- "type": "boolean"
1920
1906
  }
1921
1907
  },
1922
1908
  "hasDynamicHelp": true,
1923
1909
  "hiddenAliases": [],
1924
- "id": "agent:test:resume",
1910
+ "id": "agent:preview:end",
1925
1911
  "pluginAlias": "@salesforce/plugin-agent",
1926
1912
  "pluginName": "@salesforce/plugin-agent",
1927
1913
  "pluginType": "core",
1928
1914
  "strict": true,
1929
- "summary": "Resume an agent test that you previously started in your org so you can view the test results.",
1915
+ "summary": "End an existing programmatic agent preview session and get trace location.",
1930
1916
  "enableJsonFlag": true,
1917
+ "requiresProject": true,
1931
1918
  "envVariablesSection": {
1932
1919
  "header": "ENVIRONMENT VARIABLES",
1933
1920
  "body": [
@@ -1942,19 +1929,19 @@
1942
1929
  "body": [
1943
1930
  {
1944
1931
  "name": "Succeeded (0)",
1945
- "description": "Test completed successfully (with test results in the output)."
1932
+ "description": "Preview session ended successfully and traces saved."
1946
1933
  },
1947
1934
  {
1948
- "name": "Failed (1)",
1949
- "description": "Tests encountered execution errors (test cases with ERROR status)."
1935
+ "name": "NotFound (2)",
1936
+ "description": "Agent not found, or no preview session exists for this agent."
1950
1937
  },
1951
1938
  {
1952
- "name": "NotFound (2)",
1953
- "description": "Job ID not found or invalid."
1939
+ "name": "PreviewEndFailed (4)",
1940
+ "description": "Failed to end the preview session."
1954
1941
  },
1955
1942
  {
1956
- "name": "OperationFailed (4)",
1957
- "description": "Failed to poll test due to API or network errors."
1943
+ "name": "SessionAmbiguous (5)",
1944
+ "description": "Multiple preview sessions found; specify --session-id to choose one."
1958
1945
  }
1959
1946
  ]
1960
1947
  },
@@ -1963,30 +1950,27 @@
1963
1950
  "lib",
1964
1951
  "commands",
1965
1952
  "agent",
1966
- "test",
1967
- "resume.js"
1953
+ "preview",
1954
+ "end.js"
1968
1955
  ],
1969
1956
  "aliasPermutations": [],
1970
1957
  "permutations": [
1971
- "agent:test:resume",
1972
- "test:agent:resume",
1973
- "test:resume:agent",
1974
- "agent:resume:test",
1975
- "resume:agent:test",
1976
- "resume:test:agent"
1958
+ "agent:preview:end",
1959
+ "preview:agent:end",
1960
+ "preview:end:agent",
1961
+ "agent:end:preview",
1962
+ "end:agent:preview",
1963
+ "end:preview:agent"
1977
1964
  ]
1978
1965
  },
1979
- "agent:test:run-eval": {
1966
+ "agent:preview:send": {
1980
1967
  "aliases": [],
1981
1968
  "args": {},
1982
- "description": "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.\n\nWhen 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`. YAML test specs also support contextVariables, which allow you to inject contextual data (such as CaseId or RoutableId) into agent sessions for testing with different contexts.\n\nWhen 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. JSON payloads can also include context_variables on agent.create_session steps for the same contextual testing capabilities.\n\nSupports 8+ evaluator types, including topic routing assertions, action invocation checks, string/numeric assertions, semantic similarity scoring, and LLM-based quality ratings.",
1969
+ "description": "You must have previously started a programmatic agent preview session with the \"agent preview start\" command to then use this command to send the agent a message (utterance). This command then displays the agent's response.\n\nThe original \"agent preview start\" command outputs a session ID which you then use with the --session-id flag of this command to send a message. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the \"aiAuthoringBundles\" metadata directory. Similarly, the published agent's API name is the same as its directory name under the \"Bots\" metadata directory.",
1983
1970
  "examples": [
1984
- "Run tests using a YAML test spec on the org with alias \"my-org\":\n<%= config.bin %> <%= command.id %> --spec tests/my-agent-testSpec.yaml --target-org my-org",
1985
- "Run tests using a YAML spec with explicit agent name override; use your default org:\n<%= config.bin %> <%= command.id %> --spec tests/my-agent-testSpec.yaml --api-name My_Agent --target-org my-org",
1986
- "Run tests using a JSON payload:\n<%= config.bin %> <%= command.id %> --spec tests/eval-payload.json --target-org my-org",
1987
- "Run tests and output results in JUnit format; useful for continuous integration and deployment (CI/CD):\n<%= config.bin %> <%= command.id %> --spec tests/my-agent-testSpec.yaml --target-org my-org --result-format junit",
1988
- "Run tests with contextVariables to inject contextual data into agent sessions (add contextVariables to test cases in your YAML spec):\n<%= config.bin %> <%= command.id %> --spec tests/agent-with-context.yaml --target-org my-org",
1989
- "Pipe JSON payload from stdin (--spec flag is automatically populated from stdin):\n$ echo '{\"tests\":[...]}' | <%= config.bin %> <%= command.id %> --spec --target-org my-org"
1971
+ "Send a message to an activated published agent using its API name and session ID; use the default org:\n<%= config.bin %> <%= command.id %> --utterance \"What can you help me with?\" --api-name My_Published_Agent --session-id <SESSION_ID>",
1972
+ "Similar to previous example, but don't specify a session ID; you get an error if the agent has more than one active session. Use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --utterance \"What can you help me with?\" --api-name My_Published_Agent --target-org my-dev-org",
1973
+ "Send a message to an agent using its authoring bundle API name; you get an error if the agent has more than one active session:\n<%= config.bin %> <%= command.id %> --utterance \"what can you help me with?\" --authoring-bundle My_Local_Agent"
1990
1974
  ],
1991
1975
  "flags": {
1992
1976
  "json": {
@@ -2021,72 +2005,49 @@
2021
2005
  "multiple": false,
2022
2006
  "type": "option"
2023
2007
  },
2024
- "spec": {
2025
- "char": "s",
2026
- "name": "spec",
2027
- "required": true,
2028
- "summary": "Path to test spec file (YAML or JSON). Supports reading from stdin when piping content.",
2029
- "hasDynamicHelp": false,
2030
- "multiple": false,
2031
- "type": "option"
2032
- },
2033
- "api-name": {
2034
- "char": "n",
2035
- "name": "api-name",
2036
- "summary": "Agent DeveloperName (also called API name) to resolve agent_id and agent_version_id. Auto-inferred from the YAML spec's subjectName.",
2008
+ "session-id": {
2009
+ "name": "session-id",
2010
+ "required": false,
2011
+ "summary": "Session ID outputted by \"agent preview start\". Not required when the agent has exactly one active session. Run \"agent preview sessions\" to see list of all sessions.",
2037
2012
  "hasDynamicHelp": false,
2038
2013
  "multiple": false,
2039
2014
  "type": "option"
2040
2015
  },
2041
- "wait": {
2042
- "char": "w",
2043
- "name": "wait",
2044
- "summary": "Number of minutes to wait for results.",
2045
- "default": 10,
2016
+ "utterance": {
2017
+ "char": "u",
2018
+ "name": "utterance",
2019
+ "required": true,
2020
+ "summary": "Utterance to send to the agent, enclosed in double quotes.",
2046
2021
  "hasDynamicHelp": false,
2047
2022
  "multiple": false,
2048
2023
  "type": "option"
2049
2024
  },
2050
- "result-format": {
2051
- "name": "result-format",
2052
- "summary": "Format of the agent test run results.",
2053
- "default": "human",
2025
+ "api-name": {
2026
+ "char": "n",
2027
+ "name": "api-name",
2028
+ "summary": "API name of the activated published agent you want to preview.",
2054
2029
  "hasDynamicHelp": false,
2055
2030
  "multiple": false,
2056
- "options": [
2057
- "json",
2058
- "human",
2059
- "junit",
2060
- "tap"
2061
- ],
2062
2031
  "type": "option"
2063
2032
  },
2064
- "batch-size": {
2065
- "name": "batch-size",
2066
- "summary": "Number of tests per API request (max 5).",
2067
- "default": 5,
2033
+ "authoring-bundle": {
2034
+ "name": "authoring-bundle",
2035
+ "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
2068
2036
  "hasDynamicHelp": false,
2069
2037
  "multiple": false,
2070
2038
  "type": "option"
2071
- },
2072
- "no-normalize": {
2073
- "name": "no-normalize",
2074
- "summary": "Disable auto-normalization of field names and shorthand references.",
2075
- "allowNo": false,
2076
- "type": "boolean"
2077
2039
  }
2078
2040
  },
2079
2041
  "hasDynamicHelp": true,
2080
- "hidden": true,
2081
2042
  "hiddenAliases": [],
2082
- "id": "agent:test:run-eval",
2043
+ "id": "agent:preview:send",
2083
2044
  "pluginAlias": "@salesforce/plugin-agent",
2084
2045
  "pluginName": "@salesforce/plugin-agent",
2085
2046
  "pluginType": "core",
2086
- "state": "beta",
2087
2047
  "strict": true,
2088
- "summary": "Run evaluation tests against an Agentforce agent.",
2048
+ "summary": "Send a message to an existing agent preview session.",
2089
2049
  "enableJsonFlag": true,
2050
+ "requiresProject": true,
2090
2051
  "envVariablesSection": {
2091
2052
  "header": "ENVIRONMENT VARIABLES",
2092
2053
  "body": [
@@ -2101,19 +2062,19 @@
2101
2062
  "body": [
2102
2063
  {
2103
2064
  "name": "Succeeded (0)",
2104
- "description": "Tests completed successfully. Test results (passed/failed) are in the JSON output."
2065
+ "description": "Message sent successfully and agent response received."
2105
2066
  },
2106
2067
  {
2107
- "name": "Failed (1)",
2108
- "description": "Tests encountered execution errors (tests couldn't run properly)."
2068
+ "name": "NotFound (2)",
2069
+ "description": "Agent not found, or no preview session exists for this agent."
2109
2070
  },
2110
2071
  {
2111
- "name": "NotFound (2)",
2112
- "description": "Agent not found, spec file not found, or invalid agent name."
2072
+ "name": "PreviewSendFailed (4)",
2073
+ "description": "Failed to send message or receive response from the preview session."
2113
2074
  },
2114
2075
  {
2115
- "name": "OperationFailed (4)",
2116
- "description": "Failed to execute tests due to API or network errors."
2076
+ "name": "SessionAmbiguous (5)",
2077
+ "description": "Multiple preview sessions found; specify --session-id to choose one."
2117
2078
  }
2118
2079
  ]
2119
2080
  },
@@ -2122,27 +2083,88 @@
2122
2083
  "lib",
2123
2084
  "commands",
2124
2085
  "agent",
2125
- "test",
2126
- "run-eval.js"
2086
+ "preview",
2087
+ "send.js"
2127
2088
  ],
2128
2089
  "aliasPermutations": [],
2129
2090
  "permutations": [
2130
- "agent:test:run-eval",
2131
- "test:agent:run-eval",
2132
- "test:run-eval:agent",
2133
- "agent:run-eval:test",
2134
- "run-eval:agent:test",
2135
- "run-eval:test:agent"
2091
+ "agent:preview:send",
2092
+ "preview:agent:send",
2093
+ "preview:send:agent",
2094
+ "agent:send:preview",
2095
+ "send:agent:preview",
2096
+ "send:preview:agent"
2136
2097
  ]
2137
2098
  },
2138
- "agent:test:run": {
2099
+ "agent:preview:sessions": {
2139
2100
  "aliases": [],
2140
2101
  "args": {},
2141
- "description": "Use the --api-name flag to specify the name of the agent test you want to run. Use the output of the \"agent test list\" command to get the names of all the available agent tests in your org.\n\nBy default, this command starts the agent test in your org, but it doesn't wait for the test to finish. Instead, it displays the \"agent test resume\" command, with a job ID, that you execute to see the results of the test run, and then returns control of the terminal window to you. Use the --wait flag to specify the number of minutes for the command to wait for the agent test to complete; if the test completes by the end of the wait time, the command displays the test results. If not, run \"agent test resume\".\n\nBy default, this command outputs test results in human-readable tables for each test case, if the test completes in time. The tables show whether the test case passed, the expected and actual values, the test score, how long the test took, and more. Use the --result-format to display the test results in JSON or Junit format. Use the --output-dir flag to write the results to a file rather than to the terminal.",
2102
+ "description": "This command lists the agent preview sessions that were started with the \"agent preview start\" command and are still in the local cache. Use this command to discover specific session IDs that you can pass to the \"agent preview send\" or \"agent preview end\" commands with the --session-id flag.\n\nProgrammatic agent preview sessions can be started for both published activated agents and by using an agent's local authoring bundle, which contains its Agent Script file. In this command's output table, the Agent column contains either the API name of the authoring bundle or the published agent, whichever was used when starting the session. In the table, if the same API name has multiple rows with different session IDs, then it means that you previously started multiple preview sessions with the associated agent.",
2142
2103
  "examples": [
2143
- "Start an agent test called Resort_Manager_Test for an agent in your default org, don't wait for the test to finish:\n<%= config.bin %> <%= command.id %> --api-name Resort_Manager_Test",
2144
- "Start an agent test for an agent in an org with alias \"my-org\" and wait for 10 minutes for the test to finish:\n<%= config.bin %> <%= command.id %> --api-name Resort_Manager_Test --wait 10 --target-org my-org",
2145
- "Start an agent test and write the JSON-formatted results into a directory called \"test-results\":\n<%= config.bin %> <%= command.id %> --api-name Resort_Manager_Test --wait 10 --output-dir ./test-results --result-format json"
2104
+ "List all cached agent preview sessions:\n<%= config.bin %> <%= command.id %>"
2105
+ ],
2106
+ "flags": {
2107
+ "json": {
2108
+ "description": "Format output as json.",
2109
+ "helpGroup": "GLOBAL",
2110
+ "name": "json",
2111
+ "allowNo": false,
2112
+ "type": "boolean"
2113
+ },
2114
+ "flags-dir": {
2115
+ "helpGroup": "GLOBAL",
2116
+ "name": "flags-dir",
2117
+ "summary": "Import flag values from a directory.",
2118
+ "hasDynamicHelp": false,
2119
+ "multiple": false,
2120
+ "type": "option"
2121
+ }
2122
+ },
2123
+ "hasDynamicHelp": false,
2124
+ "hiddenAliases": [],
2125
+ "id": "agent:preview:sessions",
2126
+ "pluginAlias": "@salesforce/plugin-agent",
2127
+ "pluginName": "@salesforce/plugin-agent",
2128
+ "pluginType": "core",
2129
+ "strict": true,
2130
+ "summary": "List all known programmatic agent preview sessions.",
2131
+ "enableJsonFlag": true,
2132
+ "requiresProject": true,
2133
+ "errorCodes": {
2134
+ "header": "ERROR CODES",
2135
+ "body": [
2136
+ {
2137
+ "name": "Succeeded (0)",
2138
+ "description": "Sessions listed successfully (or empty list if no active sessions)."
2139
+ }
2140
+ ]
2141
+ },
2142
+ "isESM": true,
2143
+ "relativePath": [
2144
+ "lib",
2145
+ "commands",
2146
+ "agent",
2147
+ "preview",
2148
+ "sessions.js"
2149
+ ],
2150
+ "aliasPermutations": [],
2151
+ "permutations": [
2152
+ "agent:preview:sessions",
2153
+ "preview:agent:sessions",
2154
+ "preview:sessions:agent",
2155
+ "agent:sessions:preview",
2156
+ "sessions:agent:preview",
2157
+ "sessions:preview:agent"
2158
+ ]
2159
+ },
2160
+ "agent:preview:start": {
2161
+ "aliases": [],
2162
+ "args": {},
2163
+ "description": "This command outputs a session ID that you then use with the \"agent preview send\" command to send an utterance to the agent. Use the \"agent preview sessions\" command to list all active sessions and the \"agent preview end\" command to end a specific session.\n\nIdentify the agent you want to start previewing with either the --authoring-bundle flag to specify a local authoring bundle's API name or --api-name to specify an activated published agent's API name. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the \"aiAuthoringBundles\" metadata directory. Similarly, the published agent's API name is the same as its directory name under the \"Bots\" metadata directory.\n\nWhen starting a preview session with --authoring-bundle, you must explicitly specify the execution mode using one of these flags:\n\n- --use-live-actions: Executes real Apex classes, flows, and other actions in the org. This surfaces compile and validation errors during preview.\n- --simulate-actions: Uses AI to simulate action execution without calling real implementations.\n\nPublished agents (--api-name) always use live actions. The mode flags are optional and have no effect for published agents.",
2164
+ "examples": [
2165
+ "Start a programmatic agent preview session by specifying an authoring bundle; use simulated actions. Use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --authoring-bundle My_Agent_Bundle --target-org my-dev-org --simulate-actions",
2166
+ "Similar to previous example but use live actions and the default org:\n<%= config.bin %> <%= command.id %> --authoring-bundle My_Agent_Bundle --use-live-actions",
2167
+ "Start a preview session with an activated published agent (always uses live actions):\n<%= config.bin %> <%= command.id %> --api-name My_Published_Agent"
2146
2168
  ],
2147
2169
  "flags": {
2148
2170
  "json": {
@@ -2180,59 +2202,58 @@
2180
2202
  "api-name": {
2181
2203
  "char": "n",
2182
2204
  "name": "api-name",
2183
- "summary": "API name of the agent test to run; corresponds to the name of the AiEvaluationDefinition metadata component that implements the agent test.",
2205
+ "summary": "API name of the activated published agent you want to preview.",
2184
2206
  "hasDynamicHelp": false,
2185
2207
  "multiple": false,
2186
2208
  "type": "option"
2187
2209
  },
2188
- "wait": {
2189
- "char": "w",
2190
- "name": "wait",
2191
- "summary": "Number of minutes to wait for the command to complete and display results to the terminal window.",
2192
- "hasDynamicHelp": true,
2210
+ "authoring-bundle": {
2211
+ "name": "authoring-bundle",
2212
+ "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
2213
+ "hasDynamicHelp": false,
2193
2214
  "multiple": false,
2194
2215
  "type": "option"
2195
2216
  },
2196
- "result-format": {
2197
- "name": "result-format",
2198
- "summary": "Format of the agent test run results.",
2199
- "default": "human",
2200
- "hasDynamicHelp": false,
2201
- "multiple": false,
2202
- "options": [
2203
- "json",
2204
- "human",
2205
- "junit",
2206
- "tap"
2217
+ "use-live-actions": {
2218
+ "exclusive": [
2219
+ "simulate-actions"
2207
2220
  ],
2208
- "type": "option"
2221
+ "name": "use-live-actions",
2222
+ "summary": "Execute real actions in the org (Apex classes, flows, etc.). Required with --authoring-bundle.",
2223
+ "allowNo": false,
2224
+ "type": "boolean"
2209
2225
  },
2210
- "output-dir": {
2211
- "char": "d",
2212
- "description": "If the agent test run completes, write the results to the specified directory. If the test is still running, the test results aren't written.",
2213
- "name": "output-dir",
2214
- "summary": "Directory to write the agent test results into.",
2226
+ "simulate-actions": {
2227
+ "exclusive": [
2228
+ "use-live-actions"
2229
+ ],
2230
+ "name": "simulate-actions",
2231
+ "summary": "Use AI to simulate action execution instead of calling real actions. Required with --authoring-bundle.",
2232
+ "allowNo": false,
2233
+ "type": "boolean"
2234
+ },
2235
+ "agent-json": {
2236
+ "dependsOn": [
2237
+ "authoring-bundle"
2238
+ ],
2239
+ "hidden": true,
2240
+ "name": "agent-json",
2241
+ "summary": "Path to a pre-compiled AgentJSON file to use instead of compiling the Agent Script file. Intended for internal use and testing.",
2215
2242
  "hasDynamicHelp": false,
2216
2243
  "multiple": false,
2217
2244
  "type": "option"
2218
- },
2219
- "verbose": {
2220
- "description": "When enabled, includes detailed generated data (such as invoked actions) in the human-readable test results output. This is useful for debugging test failures and understanding what actions were actually invoked during the test run.\n\nThe generated data is in JSON format and includes the Apex classes or Flows that were invoked, the Salesforce objects that were touched, and so on. Use the JSON structure of this information to build the test case JSONPath expression when using custom evaluations.",
2221
- "name": "verbose",
2222
- "summary": "Show generated data in the test results output.",
2223
- "allowNo": false,
2224
- "type": "boolean"
2225
2245
  }
2226
2246
  },
2227
2247
  "hasDynamicHelp": true,
2228
2248
  "hiddenAliases": [],
2229
- "id": "agent:test:run",
2249
+ "id": "agent:preview:start",
2230
2250
  "pluginAlias": "@salesforce/plugin-agent",
2231
2251
  "pluginName": "@salesforce/plugin-agent",
2232
2252
  "pluginType": "core",
2233
2253
  "strict": true,
2234
- "summary": "Start an agent test in your org.",
2254
+ "summary": "Start a programmatic agent preview session.",
2235
2255
  "enableJsonFlag": true,
2256
+ "requiresProject": true,
2236
2257
  "envVariablesSection": {
2237
2258
  "header": "ENVIRONMENT VARIABLES",
2238
2259
  "body": [
@@ -2247,19 +2268,23 @@
2247
2268
  "body": [
2248
2269
  {
2249
2270
  "name": "Succeeded (0)",
2250
- "description": "Test started successfully (without --wait), or test completed successfully (with --wait)."
2271
+ "description": "Preview session started successfully."
2251
2272
  },
2252
2273
  {
2253
2274
  "name": "Failed (1)",
2254
- "description": "Tests encountered execution errors (test cases with ERROR status when using --wait)."
2275
+ "description": "Agent Script compilation failed (syntax errors in the script)."
2255
2276
  },
2256
2277
  {
2257
2278
  "name": "NotFound (2)",
2258
- "description": "Test definition not found or invalid test name."
2279
+ "description": "Agent not found, or compilation API returned HTTP 404 (endpoint may not be available in your org or region)."
2259
2280
  },
2260
2281
  {
2261
- "name": "OperationFailed (4)",
2262
- "description": "Failed to start or poll test due to API or network errors."
2282
+ "name": "ServerError (3)",
2283
+ "description": "Compilation API returned HTTP 500 (server error during compilation)."
2284
+ },
2285
+ {
2286
+ "name": "PreviewStartFailed (4)",
2287
+ "description": "Preview session failed to start due to API or network errors."
2263
2288
  }
2264
2289
  ]
2265
2290
  },
@@ -2268,17 +2293,17 @@
2268
2293
  "lib",
2269
2294
  "commands",
2270
2295
  "agent",
2271
- "test",
2272
- "run.js"
2296
+ "preview",
2297
+ "start.js"
2273
2298
  ],
2274
2299
  "aliasPermutations": [],
2275
2300
  "permutations": [
2276
- "agent:test:run",
2277
- "test:agent:run",
2278
- "test:run:agent",
2279
- "agent:run:test",
2280
- "run:agent:test",
2281
- "run:test:agent"
2301
+ "agent:preview:start",
2302
+ "preview:agent:start",
2303
+ "preview:start:agent",
2304
+ "agent:start:preview",
2305
+ "start:agent:preview",
2306
+ "start:preview:agent"
2282
2307
  ]
2283
2308
  },
2284
2309
  "agent:validate:authoring-bundle": {
@@ -2396,5 +2421,5 @@
2396
2421
  ]
2397
2422
  }
2398
2423
  },
2399
- "version": "1.36.0"
2424
+ "version": "1.37.0"
2400
2425
  }