@salesforce/plugin-agent 1.40.1 → 1.40.2

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 (3) hide show
  1. package/README.md +23 -23
  2. package/oclif.manifest.json +521 -521
  3. package/package.json +4 -4
@@ -1003,16 +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, respectively. 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\nUse the --all flag to end all active preview sessions at once. You can combine --all with --api-name or --authoring-bundle to end only sessions for a specific agent, or use --all on its own to end every session across all agents in the project.",
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",
1014
- "End all active preview sessions for a specific agent without prompting:\n<%= config.bin %> <%= command.id %> --all --authoring-bundle My_Local_Agent --target-org <target_org> --no-prompt",
1015
- "End all active preview sessions across every agent in the local session cache for an org:\n<%= config.bin %> <%= command.id %> --all --target-org <target_org>"
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"
1016
1014
  ],
1017
1015
  "flags": {
1018
1016
  "json": {
@@ -1030,6 +1028,20 @@
1030
1028
  "multiple": false,
1031
1029
  "type": "option"
1032
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
+ },
1033
1045
  "target-org": {
1034
1046
  "char": "o",
1035
1047
  "name": "target-org",
@@ -1047,65 +1059,28 @@
1047
1059
  "multiple": false,
1048
1060
  "type": "option"
1049
1061
  },
1050
- "session-id": {
1051
- "exclusive": [
1052
- "all"
1053
- ],
1054
- "name": "session-id",
1055
- "required": false,
1056
- "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.",
1057
- "hasDynamicHelp": false,
1058
- "multiple": false,
1059
- "type": "option"
1060
- },
1061
- "api-name": {
1062
- "char": "n",
1063
- "exclusive": [
1064
- "authoring-bundle"
1065
- ],
1066
- "name": "api-name",
1067
- "summary": "API name of the activated published agent you want to preview.",
1068
- "hasDynamicHelp": false,
1069
- "multiple": false,
1070
- "type": "option"
1071
- },
1072
- "authoring-bundle": {
1073
- "exclusive": [
1074
- "api-name"
1075
- ],
1076
- "name": "authoring-bundle",
1077
- "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
1078
- "hasDynamicHelp": false,
1079
- "multiple": false,
1080
- "type": "option"
1081
- },
1082
- "all": {
1083
- "exclusive": [
1084
- "session-id"
1085
- ],
1086
- "name": "all",
1087
- "summary": "End all active preview sessions. Combine with --api-name or --authoring-bundle to limit to a specific agent, or use with only --target-org to end sessions for all agents found in the local session cache. Requires --target-org.",
1062
+ "preview": {
1063
+ "name": "preview",
1064
+ "summary": "Preview the test metadata file (AiEvaluationDefinition) without deploying to your org.",
1088
1065
  "allowNo": false,
1089
1066
  "type": "boolean"
1090
1067
  },
1091
- "no-prompt": {
1092
- "char": "p",
1093
- "name": "no-prompt",
1094
- "summary": "Don't prompt for confirmation before ending sessions. Has an effect only when used with --all.",
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.",
1095
1071
  "allowNo": false,
1096
1072
  "type": "boolean"
1097
1073
  }
1098
1074
  },
1099
1075
  "hasDynamicHelp": true,
1100
1076
  "hiddenAliases": [],
1101
- "id": "agent:preview:end",
1077
+ "id": "agent:test:create",
1102
1078
  "pluginAlias": "@salesforce/plugin-agent",
1103
1079
  "pluginName": "@salesforce/plugin-agent",
1104
1080
  "pluginType": "core",
1105
1081
  "strict": true,
1106
- "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.",
1107
1083
  "enableJsonFlag": true,
1108
- "requiresProject": true,
1109
1084
  "envVariablesSection": {
1110
1085
  "header": "ENVIRONMENT VARIABLES",
1111
1086
  "body": [
@@ -1120,27 +1095,19 @@
1120
1095
  "body": [
1121
1096
  {
1122
1097
  "name": "Succeeded (0)",
1123
- "description": "Preview session ended successfully and traces saved."
1098
+ "description": "Test created and deployed successfully."
1124
1099
  },
1125
1100
  {
1126
- "name": "ExactlyOneRequired (2)",
1127
- "description": "Neither --api-name nor --authoring-bundle was provided (required when --all is not set)."
1101
+ "name": "Failed (1)",
1102
+ "description": "Test validation errors or metadata format issues."
1128
1103
  },
1129
1104
  {
1130
1105
  "name": "NotFound (2)",
1131
- "description": "Agent not found, or no preview session exists for this agent."
1132
- },
1133
- {
1134
- "name": "PreviewEndFailed (4)",
1135
- "description": "Failed to end the preview session."
1136
- },
1137
- {
1138
- "name": "PreviewEndPartialFailure (68)",
1139
- "description": "With --all, one or more sessions failed to end while others succeeded."
1106
+ "description": "Test spec file not found or org connection failed."
1140
1107
  },
1141
1108
  {
1142
- "name": "SessionAmbiguous (5)",
1143
- "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."
1144
1111
  }
1145
1112
  ]
1146
1113
  },
@@ -1149,27 +1116,26 @@
1149
1116
  "lib",
1150
1117
  "commands",
1151
1118
  "agent",
1152
- "preview",
1153
- "end.js"
1119
+ "test",
1120
+ "create.js"
1154
1121
  ],
1155
1122
  "aliasPermutations": [],
1156
1123
  "permutations": [
1157
- "agent:preview:end",
1158
- "preview:agent:end",
1159
- "preview:end:agent",
1160
- "agent:end:preview",
1161
- "end:agent:preview",
1162
- "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"
1163
1130
  ]
1164
1131
  },
1165
- "agent:preview:send": {
1132
+ "agent:test:list": {
1166
1133
  "aliases": [],
1167
1134
  "args": {},
1168
- "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.",
1169
1136
  "examples": [
1170
- "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>",
1171
- "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",
1172
- "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"
1173
1139
  ],
1174
1140
  "flags": {
1175
1141
  "json": {
@@ -1203,50 +1169,17 @@
1203
1169
  "hasDynamicHelp": false,
1204
1170
  "multiple": false,
1205
1171
  "type": "option"
1206
- },
1207
- "session-id": {
1208
- "name": "session-id",
1209
- "required": false,
1210
- "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.",
1211
- "hasDynamicHelp": false,
1212
- "multiple": false,
1213
- "type": "option"
1214
- },
1215
- "utterance": {
1216
- "char": "u",
1217
- "name": "utterance",
1218
- "required": true,
1219
- "summary": "Utterance to send to the agent, enclosed in double quotes.",
1220
- "hasDynamicHelp": false,
1221
- "multiple": false,
1222
- "type": "option"
1223
- },
1224
- "api-name": {
1225
- "char": "n",
1226
- "name": "api-name",
1227
- "summary": "API name of the activated published agent you want to preview.",
1228
- "hasDynamicHelp": false,
1229
- "multiple": false,
1230
- "type": "option"
1231
- },
1232
- "authoring-bundle": {
1233
- "name": "authoring-bundle",
1234
- "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
1235
- "hasDynamicHelp": false,
1236
- "multiple": false,
1237
- "type": "option"
1238
1172
  }
1239
1173
  },
1240
1174
  "hasDynamicHelp": true,
1241
1175
  "hiddenAliases": [],
1242
- "id": "agent:preview:send",
1176
+ "id": "agent:test:list",
1243
1177
  "pluginAlias": "@salesforce/plugin-agent",
1244
1178
  "pluginName": "@salesforce/plugin-agent",
1245
1179
  "pluginType": "core",
1246
1180
  "strict": true,
1247
- "summary": "Send a message to an existing agent preview session.",
1181
+ "summary": "List the available agent tests in your org.",
1248
1182
  "enableJsonFlag": true,
1249
- "requiresProject": true,
1250
1183
  "envVariablesSection": {
1251
1184
  "header": "ENVIRONMENT VARIABLES",
1252
1185
  "body": [
@@ -1261,19 +1194,11 @@
1261
1194
  "body": [
1262
1195
  {
1263
1196
  "name": "Succeeded (0)",
1264
- "description": "Message sent successfully and agent response received."
1265
- },
1266
- {
1267
- "name": "NotFound (2)",
1268
- "description": "Agent not found, or no preview session exists for this agent."
1269
- },
1270
- {
1271
- "name": "PreviewSendFailed (4)",
1272
- "description": "Failed to send message or receive response from the preview session."
1197
+ "description": "Agent tests listed successfully."
1273
1198
  },
1274
1199
  {
1275
- "name": "SessionAmbiguous (5)",
1276
- "description": "Multiple preview sessions found; specify --session-id to choose one."
1200
+ "name": "Failed (4)",
1201
+ "description": "Failed to retrieve agent tests due to API or network errors."
1277
1202
  }
1278
1203
  ]
1279
1204
  },
@@ -1282,88 +1207,27 @@
1282
1207
  "lib",
1283
1208
  "commands",
1284
1209
  "agent",
1285
- "preview",
1286
- "send.js"
1210
+ "test",
1211
+ "list.js"
1287
1212
  ],
1288
1213
  "aliasPermutations": [],
1289
1214
  "permutations": [
1290
- "agent:preview:send",
1291
- "preview:agent:send",
1292
- "preview:send:agent",
1293
- "agent:send:preview",
1294
- "send:agent:preview",
1295
- "send: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"
1296
1221
  ]
1297
1222
  },
1298
- "agent:preview:sessions": {
1223
+ "agent:test:results": {
1299
1224
  "aliases": [],
1300
1225
  "args": {},
1301
- "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.",
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.",
1302
1227
  "examples": [
1303
- "List all cached agent preview sessions:\n<%= config.bin %> <%= command.id %>"
1304
- ],
1305
- "flags": {
1306
- "json": {
1307
- "description": "Format output as json.",
1308
- "helpGroup": "GLOBAL",
1309
- "name": "json",
1310
- "allowNo": false,
1311
- "type": "boolean"
1312
- },
1313
- "flags-dir": {
1314
- "helpGroup": "GLOBAL",
1315
- "name": "flags-dir",
1316
- "summary": "Import flag values from a directory.",
1317
- "hasDynamicHelp": false,
1318
- "multiple": false,
1319
- "type": "option"
1320
- }
1321
- },
1322
- "hasDynamicHelp": false,
1323
- "hiddenAliases": [],
1324
- "id": "agent:preview:sessions",
1325
- "pluginAlias": "@salesforce/plugin-agent",
1326
- "pluginName": "@salesforce/plugin-agent",
1327
- "pluginType": "core",
1328
- "strict": true,
1329
- "summary": "List all known programmatic agent preview sessions.",
1330
- "enableJsonFlag": true,
1331
- "requiresProject": true,
1332
- "errorCodes": {
1333
- "header": "ERROR CODES",
1334
- "body": [
1335
- {
1336
- "name": "Succeeded (0)",
1337
- "description": "Sessions listed successfully (or empty list if no active sessions)."
1338
- }
1339
- ]
1340
- },
1341
- "isESM": true,
1342
- "relativePath": [
1343
- "lib",
1344
- "commands",
1345
- "agent",
1346
- "preview",
1347
- "sessions.js"
1348
- ],
1349
- "aliasPermutations": [],
1350
- "permutations": [
1351
- "agent:preview:sessions",
1352
- "preview:agent:sessions",
1353
- "preview:sessions:agent",
1354
- "agent:sessions:preview",
1355
- "sessions:agent:preview",
1356
- "sessions:preview:agent"
1357
- ]
1358
- },
1359
- "agent:preview:start": {
1360
- "aliases": [],
1361
- "args": {},
1362
- "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.",
1363
- "examples": [
1364
- "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",
1365
- "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",
1366
- "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"
1367
1231
  ],
1368
1232
  "flags": {
1369
1233
  "json": {
@@ -1398,61 +1262,67 @@
1398
1262
  "multiple": false,
1399
1263
  "type": "option"
1400
1264
  },
1401
- "api-name": {
1402
- "char": "n",
1403
- "name": "api-name",
1404
- "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.",
1405
1270
  "hasDynamicHelp": false,
1406
1271
  "multiple": false,
1407
1272
  "type": "option"
1408
1273
  },
1409
- "authoring-bundle": {
1410
- "name": "authoring-bundle",
1411
- "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",
1412
1278
  "hasDynamicHelp": false,
1413
1279
  "multiple": false,
1414
- "type": "option"
1415
- },
1416
- "use-live-actions": {
1417
- "exclusive": [
1418
- "simulate-actions"
1280
+ "options": [
1281
+ "json",
1282
+ "human",
1283
+ "junit",
1284
+ "tap"
1419
1285
  ],
1420
- "name": "use-live-actions",
1421
- "summary": "Execute real actions in the org (Apex classes, flows, etc.). Required with --authoring-bundle.",
1422
- "allowNo": false,
1423
- "type": "boolean"
1286
+ "type": "option"
1424
1287
  },
1425
- "simulate-actions": {
1426
- "exclusive": [
1427
- "use-live-actions"
1428
- ],
1429
- "name": "simulate-actions",
1430
- "summary": "Use AI to simulate action execution instead of calling real actions. Required with --authoring-bundle.",
1431
- "allowNo": false,
1432
- "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"
1433
1296
  },
1434
- "agent-json": {
1435
- "dependsOn": [
1436
- "authoring-bundle"
1437
- ],
1438
- "hidden": true,
1439
- "name": "agent-json",
1440
- "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).",
1441
1301
  "hasDynamicHelp": false,
1442
1302
  "multiple": false,
1303
+ "options": [
1304
+ "agentforce-studio",
1305
+ "testing-center"
1306
+ ],
1443
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"
1444
1315
  }
1445
1316
  },
1446
1317
  "hasDynamicHelp": true,
1447
1318
  "hiddenAliases": [],
1448
- "id": "agent:preview:start",
1319
+ "id": "agent:test:results",
1449
1320
  "pluginAlias": "@salesforce/plugin-agent",
1450
1321
  "pluginName": "@salesforce/plugin-agent",
1451
1322
  "pluginType": "core",
1452
1323
  "strict": true,
1453
- "summary": "Start a programmatic agent preview session.",
1324
+ "summary": "Get the results of a completed agent test run.",
1454
1325
  "enableJsonFlag": true,
1455
- "requiresProject": true,
1456
1326
  "envVariablesSection": {
1457
1327
  "header": "ENVIRONMENT VARIABLES",
1458
1328
  "body": [
@@ -1467,23 +1337,15 @@
1467
1337
  "body": [
1468
1338
  {
1469
1339
  "name": "Succeeded (0)",
1470
- "description": "Preview session started successfully."
1471
- },
1472
- {
1473
- "name": "Failed (1)",
1474
- "description": "Agent Script compilation failed (syntax errors in the script)."
1340
+ "description": "Results retrieved successfully. Test results (passed/failed) are in the output."
1475
1341
  },
1476
1342
  {
1477
1343
  "name": "NotFound (2)",
1478
- "description": "Agent not found, or compilation API returned HTTP 404 (endpoint may not be available in your org or region)."
1479
- },
1480
- {
1481
- "name": "ServerError (3)",
1482
- "description": "Compilation API returned HTTP 500 (server error during compilation)."
1344
+ "description": "Job ID not found or invalid."
1483
1345
  },
1484
1346
  {
1485
- "name": "PreviewStartFailed (4)",
1486
- "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."
1487
1349
  }
1488
1350
  ]
1489
1351
  },
@@ -1492,27 +1354,27 @@
1492
1354
  "lib",
1493
1355
  "commands",
1494
1356
  "agent",
1495
- "preview",
1496
- "start.js"
1357
+ "test",
1358
+ "results.js"
1497
1359
  ],
1498
1360
  "aliasPermutations": [],
1499
1361
  "permutations": [
1500
- "agent:preview:start",
1501
- "preview:agent:start",
1502
- "preview:start:agent",
1503
- "agent:start:preview",
1504
- "start:agent:preview",
1505
- "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"
1506
1368
  ]
1507
1369
  },
1508
- "agent:test:create": {
1370
+ "agent:test:resume": {
1509
1371
  "aliases": [],
1510
1372
  "args": {},
1511
- "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.",
1512
1374
  "examples": [
1513
- "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 %>",
1514
- "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",
1515
- "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"
1516
1378
  ],
1517
1379
  "flags": {
1518
1380
  "json": {
@@ -1530,20 +1392,6 @@
1530
1392
  "multiple": false,
1531
1393
  "type": "option"
1532
1394
  },
1533
- "api-name": {
1534
- "name": "api-name",
1535
- "summary": "API name of the new test; the API name must not exist in the org.",
1536
- "hasDynamicHelp": false,
1537
- "multiple": false,
1538
- "type": "option"
1539
- },
1540
- "spec": {
1541
- "name": "spec",
1542
- "summary": "Path to the test spec YAML file.",
1543
- "hasDynamicHelp": false,
1544
- "multiple": false,
1545
- "type": "option"
1546
- },
1547
1395
  "target-org": {
1548
1396
  "char": "o",
1549
1397
  "name": "target-org",
@@ -1561,27 +1409,81 @@
1561
1409
  "multiple": false,
1562
1410
  "type": "option"
1563
1411
  },
1564
- "preview": {
1565
- "name": "preview",
1566
- "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.",
1567
1424
  "allowNo": false,
1568
1425
  "type": "boolean"
1569
1426
  },
1570
- "force-overwrite": {
1571
- "name": "force-overwrite",
1572
- "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.",
1573
1475
  "allowNo": false,
1574
1476
  "type": "boolean"
1575
1477
  }
1576
1478
  },
1577
1479
  "hasDynamicHelp": true,
1578
1480
  "hiddenAliases": [],
1579
- "id": "agent:test:create",
1481
+ "id": "agent:test:resume",
1580
1482
  "pluginAlias": "@salesforce/plugin-agent",
1581
1483
  "pluginName": "@salesforce/plugin-agent",
1582
1484
  "pluginType": "core",
1583
1485
  "strict": true,
1584
- "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.",
1585
1487
  "enableJsonFlag": true,
1586
1488
  "envVariablesSection": {
1587
1489
  "header": "ENVIRONMENT VARIABLES",
@@ -1597,19 +1499,19 @@
1597
1499
  "body": [
1598
1500
  {
1599
1501
  "name": "Succeeded (0)",
1600
- "description": "Test created and deployed successfully."
1502
+ "description": "Test completed successfully (with test results in the output)."
1601
1503
  },
1602
1504
  {
1603
1505
  "name": "Failed (1)",
1604
- "description": "Test validation errors or metadata format issues."
1506
+ "description": "Tests encountered execution errors (test cases with ERROR status)."
1605
1507
  },
1606
1508
  {
1607
1509
  "name": "NotFound (2)",
1608
- "description": "Test spec file not found or org connection failed."
1510
+ "description": "Job ID not found or invalid."
1609
1511
  },
1610
1512
  {
1611
- "name": "DeploymentFailed (4)",
1612
- "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."
1613
1515
  }
1614
1516
  ]
1615
1517
  },
@@ -1619,25 +1521,29 @@
1619
1521
  "commands",
1620
1522
  "agent",
1621
1523
  "test",
1622
- "create.js"
1524
+ "resume.js"
1623
1525
  ],
1624
1526
  "aliasPermutations": [],
1625
1527
  "permutations": [
1626
- "agent:test:create",
1627
- "test:agent:create",
1628
- "test:create:agent",
1629
- "agent:create:test",
1630
- "create:agent:test",
1631
- "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"
1632
1534
  ]
1633
1535
  },
1634
- "agent:test:list": {
1536
+ "agent:test:run-eval": {
1635
1537
  "aliases": [],
1636
1538
  "args": {},
1637
- "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.",
1539
+ "description": "Specify the tests you want to run with one of these inputs to the --spec flag:\n\n- YAML test spec generated by the `agent generate test-spec` CLI command\n- JSON payload\n\nWhen you provide a YAML test spec, this command automatically translates test cases into internal state-based evaluation framework calls and infers the agent name from the test spec's `subjectName` field. As a result, you can use the same test spec with both the `agent test run` and `agent test run-eval` commands. YAML test specs also support context variables, 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 evaluation framework 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 as when you use a YAML test spec.\n\nThis command supports more than 8 evaluator types, including subagent routing assertions, action invocation checks, string/numeric assertions, semantic similarity scoring, and LLM-based quality ratings.",
1638
1540
  "examples": [
1639
- "List the agent tests in your default org:\n<%= config.bin %> <%= command.id %>",
1640
- "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 specs/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 specs/my-agent-testSpec.yaml --api-name My_Agent",
1543
+ "Run tests using a JSON payload:\n<%= config.bin %> <%= command.id %> --spec specs/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 specs/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 specs/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"
1641
1547
  ],
1642
1548
  "flags": {
1643
1549
  "json": {
@@ -1665,22 +1571,68 @@
1665
1571
  "multiple": false,
1666
1572
  "type": "option"
1667
1573
  },
1668
- "api-version": {
1669
- "description": "Override the api version used for api requests made by this command",
1670
- "name": "api-version",
1574
+ "api-version": {
1575
+ "description": "Override the api version used for api requests made by this command",
1576
+ "name": "api-version",
1577
+ "hasDynamicHelp": false,
1578
+ "multiple": false,
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 API name (also called DeveloperName) used 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,
1671
1616
  "hasDynamicHelp": false,
1672
1617
  "multiple": false,
1673
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"
1674
1625
  }
1675
1626
  },
1676
1627
  "hasDynamicHelp": true,
1677
1628
  "hiddenAliases": [],
1678
- "id": "agent:test:list",
1629
+ "id": "agent:test:run-eval",
1679
1630
  "pluginAlias": "@salesforce/plugin-agent",
1680
1631
  "pluginName": "@salesforce/plugin-agent",
1681
1632
  "pluginType": "core",
1633
+ "state": "beta",
1682
1634
  "strict": true,
1683
- "summary": "List the available agent tests in your org.",
1635
+ "summary": "Run rich evaluation tests against an Agentforce agent.",
1684
1636
  "enableJsonFlag": true,
1685
1637
  "envVariablesSection": {
1686
1638
  "header": "ENVIRONMENT VARIABLES",
@@ -1696,11 +1648,19 @@
1696
1648
  "body": [
1697
1649
  {
1698
1650
  "name": "Succeeded (0)",
1699
- "description": "Agent tests listed successfully."
1651
+ "description": "Tests completed successfully. Test results (passed/failed) are in the JSON output."
1700
1652
  },
1701
1653
  {
1702
- "name": "Failed (4)",
1703
- "description": "Failed to retrieve agent tests due to API or network errors."
1654
+ "name": "Failed (1)",
1655
+ "description": "Tests encountered execution errors (tests couldn't run properly)."
1656
+ },
1657
+ {
1658
+ "name": "NotFound (2)",
1659
+ "description": "Agent not found, spec file not found, or invalid agent name."
1660
+ },
1661
+ {
1662
+ "name": "OperationFailed (4)",
1663
+ "description": "Failed to execute tests due to API or network errors."
1704
1664
  }
1705
1665
  ]
1706
1666
  },
@@ -1710,26 +1670,26 @@
1710
1670
  "commands",
1711
1671
  "agent",
1712
1672
  "test",
1713
- "list.js"
1673
+ "run-eval.js"
1714
1674
  ],
1715
1675
  "aliasPermutations": [],
1716
1676
  "permutations": [
1717
- "agent:test:list",
1718
- "test:agent:list",
1719
- "test:list:agent",
1720
- "agent:list:test",
1721
- "list:agent:test",
1722
- "list:test:agent"
1677
+ "agent:test:run-eval",
1678
+ "test:agent:run-eval",
1679
+ "test:run-eval:agent",
1680
+ "agent:run-eval:test",
1681
+ "run-eval:agent:test",
1682
+ "run-eval:test:agent"
1723
1683
  ]
1724
1684
  },
1725
- "agent:test:results": {
1685
+ "agent:test:run": {
1726
1686
  "aliases": [],
1727
1687
  "args": {},
1728
- "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.",
1688
+ "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.",
1729
1689
  "examples": [
1730
- "Get the results of an agent test run in your default org using its job ID:\n<%= config.bin %> <%= command.id %> --job-id 4KBfake0000003F4AQ",
1731
- "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",
1732
- "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"
1690
+ "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",
1691
+ "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",
1692
+ "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"
1733
1693
  ],
1734
1694
  "flags": {
1735
1695
  "json": {
@@ -1764,15 +1724,22 @@
1764
1724
  "multiple": false,
1765
1725
  "type": "option"
1766
1726
  },
1767
- "job-id": {
1768
- "char": "i",
1769
- "name": "job-id",
1770
- "required": true,
1771
- "summary": "Job ID of the completed agent test run.",
1727
+ "api-name": {
1728
+ "char": "n",
1729
+ "name": "api-name",
1730
+ "summary": "API name of the agent test to run; corresponds to the name of the AiEvaluationDefinition metadata component that implements the agent test.",
1772
1731
  "hasDynamicHelp": false,
1773
1732
  "multiple": false,
1774
1733
  "type": "option"
1775
1734
  },
1735
+ "wait": {
1736
+ "char": "w",
1737
+ "name": "wait",
1738
+ "summary": "Number of minutes to wait for the command to complete and display results to the terminal window.",
1739
+ "hasDynamicHelp": true,
1740
+ "multiple": false,
1741
+ "type": "option"
1742
+ },
1776
1743
  "result-format": {
1777
1744
  "name": "result-format",
1778
1745
  "summary": "Format of the agent test run results.",
@@ -1818,12 +1785,12 @@
1818
1785
  },
1819
1786
  "hasDynamicHelp": true,
1820
1787
  "hiddenAliases": [],
1821
- "id": "agent:test:results",
1788
+ "id": "agent:test:run",
1822
1789
  "pluginAlias": "@salesforce/plugin-agent",
1823
1790
  "pluginName": "@salesforce/plugin-agent",
1824
1791
  "pluginType": "core",
1825
1792
  "strict": true,
1826
- "summary": "Get the results of a completed agent test run.",
1793
+ "summary": "Start an agent test in your org.",
1827
1794
  "enableJsonFlag": true,
1828
1795
  "envVariablesSection": {
1829
1796
  "header": "ENVIRONMENT VARIABLES",
@@ -1839,15 +1806,19 @@
1839
1806
  "body": [
1840
1807
  {
1841
1808
  "name": "Succeeded (0)",
1842
- "description": "Results retrieved successfully. Test results (passed/failed) are in the output."
1809
+ "description": "Test started successfully (without --wait), or test completed successfully (with --wait)."
1810
+ },
1811
+ {
1812
+ "name": "Failed (1)",
1813
+ "description": "Tests encountered execution errors (test cases with ERROR status when using --wait)."
1843
1814
  },
1844
1815
  {
1845
1816
  "name": "NotFound (2)",
1846
- "description": "Job ID not found or invalid."
1817
+ "description": "Test definition not found or invalid test name."
1847
1818
  },
1848
1819
  {
1849
- "name": "Failed (4)",
1850
- "description": "Failed to retrieve results due to API or network errors."
1820
+ "name": "OperationFailed (4)",
1821
+ "description": "Failed to start or poll test due to API or network errors."
1851
1822
  }
1852
1823
  ]
1853
1824
  },
@@ -1857,26 +1828,28 @@
1857
1828
  "commands",
1858
1829
  "agent",
1859
1830
  "test",
1860
- "results.js"
1831
+ "run.js"
1861
1832
  ],
1862
1833
  "aliasPermutations": [],
1863
1834
  "permutations": [
1864
- "agent:test:results",
1865
- "test:agent:results",
1866
- "test:results:agent",
1867
- "agent:results:test",
1868
- "results:agent:test",
1869
- "results:test:agent"
1835
+ "agent:test:run",
1836
+ "test:agent:run",
1837
+ "test:run:agent",
1838
+ "agent:run:test",
1839
+ "run:agent:test",
1840
+ "run:test:agent"
1870
1841
  ]
1871
1842
  },
1872
- "agent:test:resume": {
1843
+ "agent:preview:end": {
1873
1844
  "aliases": [],
1874
1845
  "args": {},
1875
- "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.",
1846
+ "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, respectively. 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\nUse the --all flag to end all active preview sessions at once. You can combine --all with --api-name or --authoring-bundle to end only sessions for a specific agent, or use --all on its own to end every session across all agents in the project.",
1876
1847
  "examples": [
1877
- "Resume an agent test in your default org using a job ID:\n<%= config.bin %> <%= command.id %> --job-id 4KBfake0000003F4AQ",
1878
- "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",
1879
- "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"
1848
+ "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",
1849
+ "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",
1850
+ "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",
1851
+ "End all active preview sessions for a specific agent without prompting:\n<%= config.bin %> <%= command.id %> --all --authoring-bundle My_Local_Agent --target-org <target_org> --no-prompt",
1852
+ "End all active preview sessions across every agent in the local session cache for an org:\n<%= config.bin %> <%= command.id %> --all --target-org <target_org>"
1880
1853
  ],
1881
1854
  "flags": {
1882
1855
  "json": {
@@ -1911,82 +1884,65 @@
1911
1884
  "multiple": false,
1912
1885
  "type": "option"
1913
1886
  },
1914
- "job-id": {
1915
- "char": "i",
1916
- "name": "job-id",
1917
- "summary": "Job ID of the original agent test run.",
1887
+ "session-id": {
1888
+ "exclusive": [
1889
+ "all"
1890
+ ],
1891
+ "name": "session-id",
1892
+ "required": false,
1893
+ "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.",
1918
1894
  "hasDynamicHelp": false,
1919
1895
  "multiple": false,
1920
1896
  "type": "option"
1921
1897
  },
1922
- "use-most-recent": {
1923
- "char": "r",
1924
- "name": "use-most-recent",
1925
- "summary": "Use the job ID of the most recent agent test run.",
1926
- "allowNo": false,
1927
- "type": "boolean"
1928
- },
1929
- "wait": {
1930
- "char": "w",
1931
- "name": "wait",
1932
- "summary": "Number of minutes to wait for the command to complete and display results to the terminal window.",
1933
- "default": "5 minutes",
1934
- "hasDynamicHelp": true,
1935
- "multiple": false,
1936
- "type": "option"
1937
- },
1938
- "result-format": {
1939
- "name": "result-format",
1940
- "summary": "Format of the agent test run results.",
1941
- "default": "human",
1898
+ "api-name": {
1899
+ "char": "n",
1900
+ "exclusive": [
1901
+ "authoring-bundle"
1902
+ ],
1903
+ "name": "api-name",
1904
+ "summary": "API name of the activated published agent you want to preview.",
1942
1905
  "hasDynamicHelp": false,
1943
1906
  "multiple": false,
1944
- "options": [
1945
- "json",
1946
- "human",
1947
- "junit",
1948
- "tap"
1949
- ],
1950
1907
  "type": "option"
1951
1908
  },
1952
- "output-dir": {
1953
- "char": "d",
1954
- "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.",
1955
- "name": "output-dir",
1956
- "summary": "Directory to write the agent test results into.",
1909
+ "authoring-bundle": {
1910
+ "exclusive": [
1911
+ "api-name"
1912
+ ],
1913
+ "name": "authoring-bundle",
1914
+ "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
1957
1915
  "hasDynamicHelp": false,
1958
1916
  "multiple": false,
1959
1917
  "type": "option"
1960
1918
  },
1961
- "test-runner": {
1962
- "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.",
1963
- "name": "test-runner",
1964
- "summary": "Explicitly specify which test runner to use (agentforce-studio or testing-center).",
1965
- "hasDynamicHelp": false,
1966
- "multiple": false,
1967
- "options": [
1968
- "agentforce-studio",
1969
- "testing-center"
1919
+ "all": {
1920
+ "exclusive": [
1921
+ "session-id"
1970
1922
  ],
1971
- "type": "option"
1923
+ "name": "all",
1924
+ "summary": "End all active preview sessions. Combine with --api-name or --authoring-bundle to limit to a specific agent, or use with only --target-org to end sessions for all agents found in the local session cache. Requires --target-org.",
1925
+ "allowNo": false,
1926
+ "type": "boolean"
1972
1927
  },
1973
- "verbose": {
1974
- "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.",
1975
- "name": "verbose",
1976
- "summary": "Show generated data in the test results output.",
1928
+ "no-prompt": {
1929
+ "char": "p",
1930
+ "name": "no-prompt",
1931
+ "summary": "Don't prompt for confirmation before ending sessions. Has an effect only when used with --all.",
1977
1932
  "allowNo": false,
1978
1933
  "type": "boolean"
1979
1934
  }
1980
1935
  },
1981
1936
  "hasDynamicHelp": true,
1982
1937
  "hiddenAliases": [],
1983
- "id": "agent:test:resume",
1938
+ "id": "agent:preview:end",
1984
1939
  "pluginAlias": "@salesforce/plugin-agent",
1985
1940
  "pluginName": "@salesforce/plugin-agent",
1986
1941
  "pluginType": "core",
1987
1942
  "strict": true,
1988
- "summary": "Resume an agent test that you previously started in your org so you can view the test results.",
1943
+ "summary": "End an existing programmatic agent preview session and get trace location.",
1989
1944
  "enableJsonFlag": true,
1945
+ "requiresProject": true,
1990
1946
  "envVariablesSection": {
1991
1947
  "header": "ENVIRONMENT VARIABLES",
1992
1948
  "body": [
@@ -2001,19 +1957,27 @@
2001
1957
  "body": [
2002
1958
  {
2003
1959
  "name": "Succeeded (0)",
2004
- "description": "Test completed successfully (with test results in the output)."
1960
+ "description": "Preview session ended successfully and traces saved."
2005
1961
  },
2006
1962
  {
2007
- "name": "Failed (1)",
2008
- "description": "Tests encountered execution errors (test cases with ERROR status)."
1963
+ "name": "ExactlyOneRequired (2)",
1964
+ "description": "Neither --api-name nor --authoring-bundle was provided (required when --all is not set)."
2009
1965
  },
2010
1966
  {
2011
1967
  "name": "NotFound (2)",
2012
- "description": "Job ID not found or invalid."
1968
+ "description": "Agent not found, or no preview session exists for this agent."
2013
1969
  },
2014
1970
  {
2015
- "name": "OperationFailed (4)",
2016
- "description": "Failed to poll test due to API or network errors."
1971
+ "name": "PreviewEndFailed (4)",
1972
+ "description": "Failed to end the preview session."
1973
+ },
1974
+ {
1975
+ "name": "PreviewEndPartialFailure (68)",
1976
+ "description": "With --all, one or more sessions failed to end while others succeeded."
1977
+ },
1978
+ {
1979
+ "name": "SessionAmbiguous (5)",
1980
+ "description": "Multiple preview sessions found; specify --session-id to choose one."
2017
1981
  }
2018
1982
  ]
2019
1983
  },
@@ -2022,30 +1986,27 @@
2022
1986
  "lib",
2023
1987
  "commands",
2024
1988
  "agent",
2025
- "test",
2026
- "resume.js"
1989
+ "preview",
1990
+ "end.js"
2027
1991
  ],
2028
1992
  "aliasPermutations": [],
2029
1993
  "permutations": [
2030
- "agent:test:resume",
2031
- "test:agent:resume",
2032
- "test:resume:agent",
2033
- "agent:resume:test",
2034
- "resume:agent:test",
2035
- "resume:test:agent"
1994
+ "agent:preview:end",
1995
+ "preview:agent:end",
1996
+ "preview:end:agent",
1997
+ "agent:end:preview",
1998
+ "end:agent:preview",
1999
+ "end:preview:agent"
2036
2000
  ]
2037
2001
  },
2038
- "agent:test:run-eval": {
2002
+ "agent:preview:send": {
2039
2003
  "aliases": [],
2040
2004
  "args": {},
2041
- "description": "Specify the tests you want to run with one of these inputs to the --spec flag:\n\n- YAML test spec generated by the `agent generate test-spec` CLI command\n- JSON payload\n\nWhen you provide a YAML test spec, this command automatically translates test cases into internal state-based evaluation framework calls and infers the agent name from the test spec's `subjectName` field. As a result, you can use the same test spec with both the `agent test run` and `agent test run-eval` commands. YAML test specs also support context variables, 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 evaluation framework 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 as when you use a YAML test spec.\n\nThis command supports more than 8 evaluator types, including subagent routing assertions, action invocation checks, string/numeric assertions, semantic similarity scoring, and LLM-based quality ratings.",
2005
+ "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.",
2042
2006
  "examples": [
2043
- "Run tests using a YAML test spec on the org with alias \"my-org\":\n<%= config.bin %> <%= command.id %> --spec specs/my-agent-testSpec.yaml --target-org my-org",
2044
- "Run tests using a YAML spec with explicit agent name override; use your default org:\n<%= config.bin %> <%= command.id %> --spec specs/my-agent-testSpec.yaml --api-name My_Agent",
2045
- "Run tests using a JSON payload:\n<%= config.bin %> <%= command.id %> --spec specs/eval-payload.json --target-org my-org",
2046
- "Run tests and output results in JUnit format; useful for continuous integration and deployment (CI/CD):\n<%= config.bin %> <%= command.id %> --spec specs/my-agent-testSpec.yaml --target-org my-org --result-format junit",
2047
- "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 specs/agent-with-context.yaml --target-org my-org",
2048
- "Pipe JSON payload from stdin (--spec flag is automatically populated from stdin):\n$ echo '{\"tests\":[...]}' | <%= config.bin %> <%= command.id %> --spec --target-org my-org"
2007
+ "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>",
2008
+ "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",
2009
+ "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"
2049
2010
  ],
2050
2011
  "flags": {
2051
2012
  "json": {
@@ -2080,62 +2041,49 @@
2080
2041
  "multiple": false,
2081
2042
  "type": "option"
2082
2043
  },
2083
- "spec": {
2084
- "char": "s",
2085
- "name": "spec",
2086
- "required": true,
2087
- "summary": "Path to test spec file (YAML or JSON). Supports reading from stdin when piping content.",
2044
+ "session-id": {
2045
+ "name": "session-id",
2046
+ "required": false,
2047
+ "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.",
2088
2048
  "hasDynamicHelp": false,
2089
2049
  "multiple": false,
2090
2050
  "type": "option"
2091
2051
  },
2092
- "api-name": {
2093
- "char": "n",
2094
- "name": "api-name",
2095
- "summary": "Agent API name (also called DeveloperName) used to resolve agent_id and agent_version_id. Auto-inferred from the YAML spec's subjectName.",
2052
+ "utterance": {
2053
+ "char": "u",
2054
+ "name": "utterance",
2055
+ "required": true,
2056
+ "summary": "Utterance to send to the agent, enclosed in double quotes.",
2096
2057
  "hasDynamicHelp": false,
2097
2058
  "multiple": false,
2098
2059
  "type": "option"
2099
2060
  },
2100
- "result-format": {
2101
- "name": "result-format",
2102
- "summary": "Format of the agent test run results.",
2103
- "default": "human",
2061
+ "api-name": {
2062
+ "char": "n",
2063
+ "name": "api-name",
2064
+ "summary": "API name of the activated published agent you want to preview.",
2104
2065
  "hasDynamicHelp": false,
2105
2066
  "multiple": false,
2106
- "options": [
2107
- "json",
2108
- "human",
2109
- "junit",
2110
- "tap"
2111
- ],
2112
2067
  "type": "option"
2113
2068
  },
2114
- "batch-size": {
2115
- "name": "batch-size",
2116
- "summary": "Number of tests per API request (max 5).",
2117
- "default": 5,
2069
+ "authoring-bundle": {
2070
+ "name": "authoring-bundle",
2071
+ "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
2118
2072
  "hasDynamicHelp": false,
2119
2073
  "multiple": false,
2120
2074
  "type": "option"
2121
- },
2122
- "no-normalize": {
2123
- "name": "no-normalize",
2124
- "summary": "Disable auto-normalization of field names and shorthand references.",
2125
- "allowNo": false,
2126
- "type": "boolean"
2127
2075
  }
2128
2076
  },
2129
2077
  "hasDynamicHelp": true,
2130
2078
  "hiddenAliases": [],
2131
- "id": "agent:test:run-eval",
2079
+ "id": "agent:preview:send",
2132
2080
  "pluginAlias": "@salesforce/plugin-agent",
2133
2081
  "pluginName": "@salesforce/plugin-agent",
2134
2082
  "pluginType": "core",
2135
- "state": "beta",
2136
2083
  "strict": true,
2137
- "summary": "Run rich evaluation tests against an Agentforce agent.",
2084
+ "summary": "Send a message to an existing agent preview session.",
2138
2085
  "enableJsonFlag": true,
2086
+ "requiresProject": true,
2139
2087
  "envVariablesSection": {
2140
2088
  "header": "ENVIRONMENT VARIABLES",
2141
2089
  "body": [
@@ -2150,19 +2098,19 @@
2150
2098
  "body": [
2151
2099
  {
2152
2100
  "name": "Succeeded (0)",
2153
- "description": "Tests completed successfully. Test results (passed/failed) are in the JSON output."
2101
+ "description": "Message sent successfully and agent response received."
2154
2102
  },
2155
2103
  {
2156
- "name": "Failed (1)",
2157
- "description": "Tests encountered execution errors (tests couldn't run properly)."
2104
+ "name": "NotFound (2)",
2105
+ "description": "Agent not found, or no preview session exists for this agent."
2158
2106
  },
2159
2107
  {
2160
- "name": "NotFound (2)",
2161
- "description": "Agent not found, spec file not found, or invalid agent name."
2108
+ "name": "PreviewSendFailed (4)",
2109
+ "description": "Failed to send message or receive response from the preview session."
2162
2110
  },
2163
2111
  {
2164
- "name": "OperationFailed (4)",
2165
- "description": "Failed to execute tests due to API or network errors."
2112
+ "name": "SessionAmbiguous (5)",
2113
+ "description": "Multiple preview sessions found; specify --session-id to choose one."
2166
2114
  }
2167
2115
  ]
2168
2116
  },
@@ -2171,27 +2119,88 @@
2171
2119
  "lib",
2172
2120
  "commands",
2173
2121
  "agent",
2174
- "test",
2175
- "run-eval.js"
2122
+ "preview",
2123
+ "send.js"
2176
2124
  ],
2177
2125
  "aliasPermutations": [],
2178
2126
  "permutations": [
2179
- "agent:test:run-eval",
2180
- "test:agent:run-eval",
2181
- "test:run-eval:agent",
2182
- "agent:run-eval:test",
2183
- "run-eval:agent:test",
2184
- "run-eval:test:agent"
2127
+ "agent:preview:send",
2128
+ "preview:agent:send",
2129
+ "preview:send:agent",
2130
+ "agent:send:preview",
2131
+ "send:agent:preview",
2132
+ "send:preview:agent"
2185
2133
  ]
2186
2134
  },
2187
- "agent:test:run": {
2135
+ "agent:preview:sessions": {
2188
2136
  "aliases": [],
2189
2137
  "args": {},
2190
- "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.",
2138
+ "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.",
2191
2139
  "examples": [
2192
- "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",
2193
- "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",
2194
- "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"
2140
+ "List all cached agent preview sessions:\n<%= config.bin %> <%= command.id %>"
2141
+ ],
2142
+ "flags": {
2143
+ "json": {
2144
+ "description": "Format output as json.",
2145
+ "helpGroup": "GLOBAL",
2146
+ "name": "json",
2147
+ "allowNo": false,
2148
+ "type": "boolean"
2149
+ },
2150
+ "flags-dir": {
2151
+ "helpGroup": "GLOBAL",
2152
+ "name": "flags-dir",
2153
+ "summary": "Import flag values from a directory.",
2154
+ "hasDynamicHelp": false,
2155
+ "multiple": false,
2156
+ "type": "option"
2157
+ }
2158
+ },
2159
+ "hasDynamicHelp": false,
2160
+ "hiddenAliases": [],
2161
+ "id": "agent:preview:sessions",
2162
+ "pluginAlias": "@salesforce/plugin-agent",
2163
+ "pluginName": "@salesforce/plugin-agent",
2164
+ "pluginType": "core",
2165
+ "strict": true,
2166
+ "summary": "List all known programmatic agent preview sessions.",
2167
+ "enableJsonFlag": true,
2168
+ "requiresProject": true,
2169
+ "errorCodes": {
2170
+ "header": "ERROR CODES",
2171
+ "body": [
2172
+ {
2173
+ "name": "Succeeded (0)",
2174
+ "description": "Sessions listed successfully (or empty list if no active sessions)."
2175
+ }
2176
+ ]
2177
+ },
2178
+ "isESM": true,
2179
+ "relativePath": [
2180
+ "lib",
2181
+ "commands",
2182
+ "agent",
2183
+ "preview",
2184
+ "sessions.js"
2185
+ ],
2186
+ "aliasPermutations": [],
2187
+ "permutations": [
2188
+ "agent:preview:sessions",
2189
+ "preview:agent:sessions",
2190
+ "preview:sessions:agent",
2191
+ "agent:sessions:preview",
2192
+ "sessions:agent:preview",
2193
+ "sessions:preview:agent"
2194
+ ]
2195
+ },
2196
+ "agent:preview:start": {
2197
+ "aliases": [],
2198
+ "args": {},
2199
+ "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.",
2200
+ "examples": [
2201
+ "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",
2202
+ "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",
2203
+ "Start a preview session with an activated published agent (always uses live actions):\n<%= config.bin %> <%= command.id %> --api-name My_Published_Agent"
2195
2204
  ],
2196
2205
  "flags": {
2197
2206
  "json": {
@@ -2229,71 +2238,58 @@
2229
2238
  "api-name": {
2230
2239
  "char": "n",
2231
2240
  "name": "api-name",
2232
- "summary": "API name of the agent test to run; corresponds to the name of the AiEvaluationDefinition metadata component that implements the agent test.",
2241
+ "summary": "API name of the activated published agent you want to preview.",
2233
2242
  "hasDynamicHelp": false,
2234
2243
  "multiple": false,
2235
2244
  "type": "option"
2236
2245
  },
2237
- "wait": {
2238
- "char": "w",
2239
- "name": "wait",
2240
- "summary": "Number of minutes to wait for the command to complete and display results to the terminal window.",
2241
- "hasDynamicHelp": true,
2246
+ "authoring-bundle": {
2247
+ "name": "authoring-bundle",
2248
+ "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
2249
+ "hasDynamicHelp": false,
2242
2250
  "multiple": false,
2243
2251
  "type": "option"
2244
2252
  },
2245
- "result-format": {
2246
- "name": "result-format",
2247
- "summary": "Format of the agent test run results.",
2248
- "default": "human",
2249
- "hasDynamicHelp": false,
2250
- "multiple": false,
2251
- "options": [
2252
- "json",
2253
- "human",
2254
- "junit",
2255
- "tap"
2253
+ "use-live-actions": {
2254
+ "exclusive": [
2255
+ "simulate-actions"
2256
2256
  ],
2257
- "type": "option"
2257
+ "name": "use-live-actions",
2258
+ "summary": "Execute real actions in the org (Apex classes, flows, etc.). Required with --authoring-bundle.",
2259
+ "allowNo": false,
2260
+ "type": "boolean"
2258
2261
  },
2259
- "output-dir": {
2260
- "char": "d",
2261
- "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.",
2262
- "name": "output-dir",
2263
- "summary": "Directory to write the agent test results into.",
2264
- "hasDynamicHelp": false,
2265
- "multiple": false,
2266
- "type": "option"
2262
+ "simulate-actions": {
2263
+ "exclusive": [
2264
+ "use-live-actions"
2265
+ ],
2266
+ "name": "simulate-actions",
2267
+ "summary": "Use AI to simulate action execution instead of calling real actions. Required with --authoring-bundle.",
2268
+ "allowNo": false,
2269
+ "type": "boolean"
2267
2270
  },
2268
- "test-runner": {
2269
- "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.",
2270
- "name": "test-runner",
2271
- "summary": "Explicitly specify which test runner to use (agentforce-studio or testing-center).",
2271
+ "agent-json": {
2272
+ "dependsOn": [
2273
+ "authoring-bundle"
2274
+ ],
2275
+ "hidden": true,
2276
+ "name": "agent-json",
2277
+ "summary": "Path to a pre-compiled AgentJSON file to use instead of compiling the Agent Script file. Intended for internal use and testing.",
2272
2278
  "hasDynamicHelp": false,
2273
2279
  "multiple": false,
2274
- "options": [
2275
- "agentforce-studio",
2276
- "testing-center"
2277
- ],
2278
2280
  "type": "option"
2279
- },
2280
- "verbose": {
2281
- "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.",
2282
- "name": "verbose",
2283
- "summary": "Show generated data in the test results output.",
2284
- "allowNo": false,
2285
- "type": "boolean"
2286
2281
  }
2287
2282
  },
2288
2283
  "hasDynamicHelp": true,
2289
2284
  "hiddenAliases": [],
2290
- "id": "agent:test:run",
2285
+ "id": "agent:preview:start",
2291
2286
  "pluginAlias": "@salesforce/plugin-agent",
2292
2287
  "pluginName": "@salesforce/plugin-agent",
2293
2288
  "pluginType": "core",
2294
2289
  "strict": true,
2295
- "summary": "Start an agent test in your org.",
2290
+ "summary": "Start a programmatic agent preview session.",
2296
2291
  "enableJsonFlag": true,
2292
+ "requiresProject": true,
2297
2293
  "envVariablesSection": {
2298
2294
  "header": "ENVIRONMENT VARIABLES",
2299
2295
  "body": [
@@ -2308,19 +2304,23 @@
2308
2304
  "body": [
2309
2305
  {
2310
2306
  "name": "Succeeded (0)",
2311
- "description": "Test started successfully (without --wait), or test completed successfully (with --wait)."
2307
+ "description": "Preview session started successfully."
2312
2308
  },
2313
2309
  {
2314
2310
  "name": "Failed (1)",
2315
- "description": "Tests encountered execution errors (test cases with ERROR status when using --wait)."
2311
+ "description": "Agent Script compilation failed (syntax errors in the script)."
2316
2312
  },
2317
2313
  {
2318
2314
  "name": "NotFound (2)",
2319
- "description": "Test definition not found or invalid test name."
2315
+ "description": "Agent not found, or compilation API returned HTTP 404 (endpoint may not be available in your org or region)."
2320
2316
  },
2321
2317
  {
2322
- "name": "OperationFailed (4)",
2323
- "description": "Failed to start or poll test due to API or network errors."
2318
+ "name": "ServerError (3)",
2319
+ "description": "Compilation API returned HTTP 500 (server error during compilation)."
2320
+ },
2321
+ {
2322
+ "name": "PreviewStartFailed (4)",
2323
+ "description": "Preview session failed to start due to API or network errors."
2324
2324
  }
2325
2325
  ]
2326
2326
  },
@@ -2329,17 +2329,17 @@
2329
2329
  "lib",
2330
2330
  "commands",
2331
2331
  "agent",
2332
- "test",
2333
- "run.js"
2332
+ "preview",
2333
+ "start.js"
2334
2334
  ],
2335
2335
  "aliasPermutations": [],
2336
2336
  "permutations": [
2337
- "agent:test:run",
2338
- "test:agent:run",
2339
- "test:run:agent",
2340
- "agent:run:test",
2341
- "run:agent:test",
2342
- "run:test:agent"
2337
+ "agent:preview:start",
2338
+ "preview:agent:start",
2339
+ "preview:start:agent",
2340
+ "agent:start:preview",
2341
+ "start:agent:preview",
2342
+ "start:preview:agent"
2343
2343
  ]
2344
2344
  },
2345
2345
  "agent:trace:delete": {
@@ -2744,5 +2744,5 @@
2744
2744
  ]
2745
2745
  }
2746
2746
  },
2747
- "version": "1.40.1"
2747
+ "version": "1.40.2"
2748
2748
  }