@salesforce/plugin-agent 1.36.1 → 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.
@@ -879,14 +879,15 @@
879
879
  "test-spec:generate:agent"
880
880
  ]
881
881
  },
882
- "agent:preview:end": {
882
+ "agent:publish:authoring-bundle": {
883
883
  "aliases": [],
884
884
  "args": {},
885
- "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.",
885
+ "description": "An authoring bundle is a metadata type (named aiAuthoringBundle) that provides the blueprint for an agent. The metadata type contains two files: the standard metatada XML file and an Agent Script file (extension \".agent\") that fully describes the agent using the Agent Script language.\n\nWhen you publish an authoring bundle to your org, a number of things happen. First, this command validates that the Agent Script file successfully compiles. If there are compilation errors, the command exits and you must fix the Agent Script file to continue. Once the Agent Script file compiles, then it's published to the org, which in turn creates new associated metadata (Bot, BotVersion, GenAiX), or new versions of the metadata if the agent already exists. The new or updated metadata is retrieved back to your DX project; specify the --skip-retrieve flag to skip this step. Finally, the authoring bundle metadata (AiAuthoringBundle) is deployed to your org.\n\nThis command uses the API name of the authoring bundle.",
886
886
  "examples": [
887
- "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",
888
- "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",
889
- "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"
887
+ "Publish an authoring bundle by being prompted for its API name; use your default org:\n<%= config.bin %> <%= command.id %>",
888
+ "Publish an authoring bundle with API name MyAuthoringBundle to the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --target-org my-dev-org",
889
+ "Publish with verbose output to see all retrieved and deployed metadata components:\n<%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --verbose",
890
+ "Publish with concise output showing only essential information:\n<%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --concise"
890
891
  ],
891
892
  "flags": {
892
893
  "json": {
@@ -921,96 +922,95 @@
921
922
  "multiple": false,
922
923
  "type": "option"
923
924
  },
924
- "session-id": {
925
- "name": "session-id",
926
- "required": false,
927
- "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.",
928
- "hasDynamicHelp": false,
929
- "multiple": false,
930
- "type": "option"
931
- },
932
925
  "api-name": {
933
926
  "char": "n",
934
927
  "name": "api-name",
935
- "summary": "API name of the activated published agent you want to preview.",
928
+ "summary": "API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from.",
936
929
  "hasDynamicHelp": false,
937
930
  "multiple": false,
938
931
  "type": "option"
939
932
  },
940
- "authoring-bundle": {
941
- "name": "authoring-bundle",
942
- "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
943
- "hasDynamicHelp": false,
944
- "multiple": false,
945
- "type": "option"
933
+ "skip-retrieve": {
934
+ "name": "skip-retrieve",
935
+ "summary": "Don't retrieve the metadata associated with the agent to your DX project.",
936
+ "allowNo": false,
937
+ "type": "boolean"
938
+ },
939
+ "verbose": {
940
+ "char": "v",
941
+ "exclusive": [
942
+ "concise"
943
+ ],
944
+ "name": "verbose",
945
+ "summary": "Display detailed output showing all metadata components retrieved and deployed during the publish process.",
946
+ "allowNo": false,
947
+ "type": "boolean"
948
+ },
949
+ "concise": {
950
+ "exclusive": [
951
+ "verbose"
952
+ ],
953
+ "name": "concise",
954
+ "summary": "Display minimal output with only essential information about the publish operation.",
955
+ "allowNo": false,
956
+ "type": "boolean"
946
957
  }
947
958
  },
948
959
  "hasDynamicHelp": true,
949
960
  "hiddenAliases": [],
950
- "id": "agent:preview:end",
961
+ "id": "agent:publish:authoring-bundle",
951
962
  "pluginAlias": "@salesforce/plugin-agent",
952
963
  "pluginName": "@salesforce/plugin-agent",
953
964
  "pluginType": "core",
954
965
  "strict": true,
955
- "summary": "End an existing programmatic agent preview session and get trace location.",
966
+ "summary": "Publish an authoring bundle to your org, which results in a new agent or a new version of an existing agent.",
956
967
  "enableJsonFlag": true,
957
968
  "requiresProject": true,
958
- "envVariablesSection": {
959
- "header": "ENVIRONMENT VARIABLES",
960
- "body": [
961
- {
962
- "name": "SF_TARGET_ORG",
963
- "description": "Username or alias of your default org. Overrides the target-org configuration variable."
964
- }
965
- ]
966
- },
967
969
  "errorCodes": {
968
970
  "header": "ERROR CODES",
969
971
  "body": [
970
972
  {
971
973
  "name": "Succeeded (0)",
972
- "description": "Preview session ended successfully and traces saved."
973
- },
974
- {
975
- "name": "NotFound (2)",
976
- "description": "Agent not found, or no preview session exists for this agent."
977
- },
978
- {
979
- "name": "PreviewEndFailed (4)",
980
- "description": "Failed to end the preview session."
974
+ "description": "Agent published successfully without errors."
981
975
  },
982
976
  {
983
- "name": "SessionAmbiguous (5)",
984
- "description": "Multiple preview sessions found; specify --session-id to choose one."
977
+ "name": "Failed (1)",
978
+ "description": "Compilation errors found in the Agent Script file."
985
979
  }
986
980
  ]
987
981
  },
982
+ "FLAGGABLE_PROMPTS": {
983
+ "api-name": {
984
+ "message": "API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from.",
985
+ "promptMessage": "API name of the authoring bundle to publish"
986
+ }
987
+ },
988
988
  "isESM": true,
989
989
  "relativePath": [
990
990
  "lib",
991
991
  "commands",
992
992
  "agent",
993
- "preview",
994
- "end.js"
993
+ "publish",
994
+ "authoring-bundle.js"
995
995
  ],
996
996
  "aliasPermutations": [],
997
997
  "permutations": [
998
- "agent:preview:end",
999
- "preview:agent:end",
1000
- "preview:end:agent",
1001
- "agent:end:preview",
1002
- "end:agent:preview",
1003
- "end:preview:agent"
998
+ "agent:publish:authoring-bundle",
999
+ "publish:agent:authoring-bundle",
1000
+ "publish:authoring-bundle:agent",
1001
+ "agent:authoring-bundle:publish",
1002
+ "authoring-bundle:agent:publish",
1003
+ "authoring-bundle:publish:agent"
1004
1004
  ]
1005
1005
  },
1006
- "agent:preview:send": {
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 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.",
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
- "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>",
1012
- "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",
1013
- "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"
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,49 +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 list of all sessions.",
1052
- "hasDynamicHelp": false,
1053
- "multiple": false,
1054
- "type": "option"
1055
- },
1056
- "utterance": {
1057
- "char": "u",
1058
- "name": "utterance",
1059
- "required": true,
1060
- "summary": "Utterance to send to the agent, enclosed in double quotes.",
1061
- "hasDynamicHelp": false,
1062
- "multiple": false,
1063
- "type": "option"
1064
- },
1065
- "api-name": {
1066
- "char": "n",
1067
- "name": "api-name",
1068
- "summary": "API name of the activated published agent you want to preview.",
1069
- "hasDynamicHelp": false,
1070
- "multiple": false,
1071
- "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"
1072
1067
  },
1073
- "authoring-bundle": {
1074
- "name": "authoring-bundle",
1075
- "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
1076
- "hasDynamicHelp": false,
1077
- "multiple": false,
1078
- "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"
1079
1073
  }
1080
1074
  },
1081
1075
  "hasDynamicHelp": true,
1082
1076
  "hiddenAliases": [],
1083
- "id": "agent:preview:send",
1077
+ "id": "agent:test:create",
1084
1078
  "pluginAlias": "@salesforce/plugin-agent",
1085
1079
  "pluginName": "@salesforce/plugin-agent",
1086
1080
  "pluginType": "core",
1087
1081
  "strict": true,
1088
- "summary": "Send a message to an existing agent preview session.",
1082
+ "summary": "Create an agent test in your org using a local test spec YAML file.",
1089
1083
  "enableJsonFlag": true,
1090
- "requiresProject": true,
1091
1084
  "envVariablesSection": {
1092
1085
  "header": "ENVIRONMENT VARIABLES",
1093
1086
  "body": [
@@ -1102,19 +1095,19 @@
1102
1095
  "body": [
1103
1096
  {
1104
1097
  "name": "Succeeded (0)",
1105
- "description": "Message sent successfully and agent response received."
1098
+ "description": "Test created and deployed successfully."
1106
1099
  },
1107
1100
  {
1108
- "name": "NotFound (2)",
1109
- "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."
1110
1103
  },
1111
1104
  {
1112
- "name": "PreviewSendFailed (4)",
1113
- "description": "Failed to send message or receive response from the preview session."
1105
+ "name": "NotFound (2)",
1106
+ "description": "Test spec file not found or org connection failed."
1114
1107
  },
1115
1108
  {
1116
- "name": "SessionAmbiguous (5)",
1117
- "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."
1118
1111
  }
1119
1112
  ]
1120
1113
  },
@@ -1123,25 +1116,26 @@
1123
1116
  "lib",
1124
1117
  "commands",
1125
1118
  "agent",
1126
- "preview",
1127
- "send.js"
1119
+ "test",
1120
+ "create.js"
1128
1121
  ],
1129
1122
  "aliasPermutations": [],
1130
1123
  "permutations": [
1131
- "agent:preview:send",
1132
- "preview:agent:send",
1133
- "preview:send:agent",
1134
- "agent:send:preview",
1135
- "send:agent:preview",
1136
- "send: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"
1137
1130
  ]
1138
1131
  },
1139
- "agent:preview:sessions": {
1132
+ "agent:test:list": {
1140
1133
  "aliases": [],
1141
1134
  "args": {},
1142
- "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.",
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.",
1143
1136
  "examples": [
1144
- "List all cached agent preview sessions:\n<%= config.bin %> <%= command.id %>"
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"
1145
1139
  ],
1146
1140
  "flags": {
1147
1141
  "json": {
@@ -1158,24 +1152,53 @@
1158
1152
  "hasDynamicHelp": false,
1159
1153
  "multiple": false,
1160
1154
  "type": "option"
1155
+ },
1156
+ "target-org": {
1157
+ "char": "o",
1158
+ "name": "target-org",
1159
+ "noCacheDefault": true,
1160
+ "required": true,
1161
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
1162
+ "hasDynamicHelp": true,
1163
+ "multiple": false,
1164
+ "type": "option"
1165
+ },
1166
+ "api-version": {
1167
+ "description": "Override the api version used for api requests made by this command",
1168
+ "name": "api-version",
1169
+ "hasDynamicHelp": false,
1170
+ "multiple": false,
1171
+ "type": "option"
1161
1172
  }
1162
1173
  },
1163
- "hasDynamicHelp": false,
1174
+ "hasDynamicHelp": true,
1164
1175
  "hiddenAliases": [],
1165
- "id": "agent:preview:sessions",
1176
+ "id": "agent:test:list",
1166
1177
  "pluginAlias": "@salesforce/plugin-agent",
1167
1178
  "pluginName": "@salesforce/plugin-agent",
1168
1179
  "pluginType": "core",
1169
1180
  "strict": true,
1170
- "summary": "List all known programmatic agent preview sessions.",
1181
+ "summary": "List the available agent tests in your org.",
1171
1182
  "enableJsonFlag": true,
1172
- "requiresProject": true,
1183
+ "envVariablesSection": {
1184
+ "header": "ENVIRONMENT VARIABLES",
1185
+ "body": [
1186
+ {
1187
+ "name": "SF_TARGET_ORG",
1188
+ "description": "Username or alias of your default org. Overrides the target-org configuration variable."
1189
+ }
1190
+ ]
1191
+ },
1173
1192
  "errorCodes": {
1174
1193
  "header": "ERROR CODES",
1175
1194
  "body": [
1176
1195
  {
1177
1196
  "name": "Succeeded (0)",
1178
- "description": "Sessions listed successfully (or empty list if no active sessions)."
1197
+ "description": "Agent tests listed successfully."
1198
+ },
1199
+ {
1200
+ "name": "Failed (4)",
1201
+ "description": "Failed to retrieve agent tests due to API or network errors."
1179
1202
  }
1180
1203
  ]
1181
1204
  },
@@ -1184,27 +1207,27 @@
1184
1207
  "lib",
1185
1208
  "commands",
1186
1209
  "agent",
1187
- "preview",
1188
- "sessions.js"
1210
+ "test",
1211
+ "list.js"
1189
1212
  ],
1190
1213
  "aliasPermutations": [],
1191
1214
  "permutations": [
1192
- "agent:preview:sessions",
1193
- "preview:agent:sessions",
1194
- "preview:sessions:agent",
1195
- "agent:sessions:preview",
1196
- "sessions:agent:preview",
1197
- "sessions:preview:agent"
1198
- ]
1215
+ "agent:test:list",
1216
+ "test:agent:list",
1217
+ "test:list:agent",
1218
+ "agent:list:test",
1219
+ "list:agent:test",
1220
+ "list:test:agent"
1221
+ ]
1199
1222
  },
1200
- "agent:preview:start": {
1223
+ "agent:test:results": {
1201
1224
  "aliases": [],
1202
1225
  "args": {},
1203
- "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.",
1204
1227
  "examples": [
1205
- "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",
1206
- "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",
1207
- "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"
1208
1231
  ],
1209
1232
  "flags": {
1210
1233
  "json": {
@@ -1239,61 +1262,67 @@
1239
1262
  "multiple": false,
1240
1263
  "type": "option"
1241
1264
  },
1242
- "api-name": {
1243
- "char": "n",
1244
- "name": "api-name",
1245
- "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.",
1246
1270
  "hasDynamicHelp": false,
1247
1271
  "multiple": false,
1248
1272
  "type": "option"
1249
1273
  },
1250
- "authoring-bundle": {
1251
- "name": "authoring-bundle",
1252
- "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",
1253
1278
  "hasDynamicHelp": false,
1254
1279
  "multiple": false,
1255
- "type": "option"
1256
- },
1257
- "use-live-actions": {
1258
- "exclusive": [
1259
- "simulate-actions"
1280
+ "options": [
1281
+ "json",
1282
+ "human",
1283
+ "junit",
1284
+ "tap"
1260
1285
  ],
1261
- "name": "use-live-actions",
1262
- "summary": "Execute real actions in the org (Apex classes, flows, etc.). Required with --authoring-bundle.",
1263
- "allowNo": false,
1264
- "type": "boolean"
1286
+ "type": "option"
1265
1287
  },
1266
- "simulate-actions": {
1267
- "exclusive": [
1268
- "use-live-actions"
1269
- ],
1270
- "name": "simulate-actions",
1271
- "summary": "Use AI to simulate action execution instead of calling real actions. Required with --authoring-bundle.",
1272
- "allowNo": false,
1273
- "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"
1274
1296
  },
1275
- "agent-json": {
1276
- "dependsOn": [
1277
- "authoring-bundle"
1278
- ],
1279
- "hidden": true,
1280
- "name": "agent-json",
1281
- "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).",
1282
1301
  "hasDynamicHelp": false,
1283
1302
  "multiple": false,
1303
+ "options": [
1304
+ "agentforce-studio",
1305
+ "testing-center"
1306
+ ],
1284
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"
1285
1315
  }
1286
1316
  },
1287
1317
  "hasDynamicHelp": true,
1288
1318
  "hiddenAliases": [],
1289
- "id": "agent:preview:start",
1319
+ "id": "agent:test:results",
1290
1320
  "pluginAlias": "@salesforce/plugin-agent",
1291
1321
  "pluginName": "@salesforce/plugin-agent",
1292
1322
  "pluginType": "core",
1293
1323
  "strict": true,
1294
- "summary": "Start a programmatic agent preview session.",
1324
+ "summary": "Get the results of a completed agent test run.",
1295
1325
  "enableJsonFlag": true,
1296
- "requiresProject": true,
1297
1326
  "envVariablesSection": {
1298
1327
  "header": "ENVIRONMENT VARIABLES",
1299
1328
  "body": [
@@ -1308,23 +1337,15 @@
1308
1337
  "body": [
1309
1338
  {
1310
1339
  "name": "Succeeded (0)",
1311
- "description": "Preview session started successfully."
1312
- },
1313
- {
1314
- "name": "Failed (1)",
1315
- "description": "Agent Script compilation failed (syntax errors in the script)."
1340
+ "description": "Results retrieved successfully. Test results (passed/failed) are in the output."
1316
1341
  },
1317
1342
  {
1318
1343
  "name": "NotFound (2)",
1319
- "description": "Agent not found, or compilation API returned HTTP 404 (endpoint may not be available in your org or region)."
1320
- },
1321
- {
1322
- "name": "ServerError (3)",
1323
- "description": "Compilation API returned HTTP 500 (server error during compilation)."
1344
+ "description": "Job ID not found or invalid."
1324
1345
  },
1325
1346
  {
1326
- "name": "PreviewStartFailed (4)",
1327
- "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."
1328
1349
  }
1329
1350
  ]
1330
1351
  },
@@ -1333,28 +1354,27 @@
1333
1354
  "lib",
1334
1355
  "commands",
1335
1356
  "agent",
1336
- "preview",
1337
- "start.js"
1357
+ "test",
1358
+ "results.js"
1338
1359
  ],
1339
1360
  "aliasPermutations": [],
1340
1361
  "permutations": [
1341
- "agent:preview:start",
1342
- "preview:agent:start",
1343
- "preview:start:agent",
1344
- "agent:start:preview",
1345
- "start:agent:preview",
1346
- "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"
1347
1368
  ]
1348
1369
  },
1349
- "agent:publish:authoring-bundle": {
1370
+ "agent:test:resume": {
1350
1371
  "aliases": [],
1351
1372
  "args": {},
1352
- "description": "An authoring bundle is a metadata type (named aiAuthoringBundle) that provides the blueprint for an agent. The metadata type contains two files: the standard metatada XML file and an Agent Script file (extension \".agent\") that fully describes the agent using the Agent Script language.\n\nWhen you publish an authoring bundle to your org, a number of things happen. First, this command validates that the Agent Script file successfully compiles. If there are compilation errors, the command exits and you must fix the Agent Script file to continue. Once the Agent Script file compiles, then it's published to the org, which in turn creates new associated metadata (Bot, BotVersion, GenAiX), or new versions of the metadata if the agent already exists. The new or updated metadata is retrieved back to your DX project; specify the --skip-retrieve flag to skip this step. Finally, the authoring bundle metadata (AiAuthoringBundle) is deployed to your org.\n\nThis command uses the API name of the authoring bundle.",
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.",
1353
1374
  "examples": [
1354
- "Publish an authoring bundle by being prompted for its API name; use your default org:\n<%= config.bin %> <%= command.id %>",
1355
- "Publish an authoring bundle with API name MyAuthoringBundle to the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --target-org my-dev-org",
1356
- "Publish with verbose output to see all retrieved and deployed metadata components:\n<%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --verbose",
1357
- "Publish with concise output showing only essential information:\n<%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --concise"
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"
1358
1378
  ],
1359
1379
  "flags": {
1360
1380
  "json": {
@@ -1389,95 +1409,141 @@
1389
1409
  "multiple": false,
1390
1410
  "type": "option"
1391
1411
  },
1392
- "api-name": {
1393
- "char": "n",
1394
- "name": "api-name",
1395
- "summary": "API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from.",
1412
+ "job-id": {
1413
+ "char": "i",
1414
+ "name": "job-id",
1415
+ "summary": "Job ID of the original agent test run.",
1396
1416
  "hasDynamicHelp": false,
1397
1417
  "multiple": false,
1398
1418
  "type": "option"
1399
1419
  },
1400
- "skip-retrieve": {
1401
- "name": "skip-retrieve",
1402
- "summary": "Don't retrieve the metadata associated with the agent to your DX project.",
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.",
1403
1424
  "allowNo": false,
1404
1425
  "type": "boolean"
1405
1426
  },
1406
- "verbose": {
1407
- "char": "v",
1408
- "exclusive": [
1409
- "concise"
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"
1410
1447
  ],
1411
- "name": "verbose",
1412
- "summary": "Display detailed output showing all metadata components retrieved and deployed during the publish process.",
1413
- "allowNo": false,
1414
- "type": "boolean"
1448
+ "type": "option"
1415
1449
  },
1416
- "concise": {
1417
- "exclusive": [
1418
- "verbose"
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"
1419
1468
  ],
1420
- "name": "concise",
1421
- "summary": "Display minimal output with only essential information about the publish operation.",
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.",
1422
1475
  "allowNo": false,
1423
1476
  "type": "boolean"
1424
1477
  }
1425
1478
  },
1426
1479
  "hasDynamicHelp": true,
1427
1480
  "hiddenAliases": [],
1428
- "id": "agent:publish:authoring-bundle",
1481
+ "id": "agent:test:resume",
1429
1482
  "pluginAlias": "@salesforce/plugin-agent",
1430
1483
  "pluginName": "@salesforce/plugin-agent",
1431
1484
  "pluginType": "core",
1432
1485
  "strict": true,
1433
- "summary": "Publish an authoring bundle to your org, which results in a new agent or a new version of an existing agent.",
1486
+ "summary": "Resume an agent test that you previously started in your org so you can view the test results.",
1434
1487
  "enableJsonFlag": true,
1435
- "requiresProject": true,
1488
+ "envVariablesSection": {
1489
+ "header": "ENVIRONMENT VARIABLES",
1490
+ "body": [
1491
+ {
1492
+ "name": "SF_TARGET_ORG",
1493
+ "description": "Username or alias of your default org. Overrides the target-org configuration variable."
1494
+ }
1495
+ ]
1496
+ },
1436
1497
  "errorCodes": {
1437
1498
  "header": "ERROR CODES",
1438
1499
  "body": [
1439
1500
  {
1440
1501
  "name": "Succeeded (0)",
1441
- "description": "Agent published successfully without errors."
1502
+ "description": "Test completed successfully (with test results in the output)."
1442
1503
  },
1443
1504
  {
1444
1505
  "name": "Failed (1)",
1445
- "description": "Compilation errors found in the Agent Script file."
1506
+ "description": "Tests encountered execution errors (test cases with ERROR status)."
1507
+ },
1508
+ {
1509
+ "name": "NotFound (2)",
1510
+ "description": "Job ID not found or invalid."
1511
+ },
1512
+ {
1513
+ "name": "OperationFailed (4)",
1514
+ "description": "Failed to poll test due to API or network errors."
1446
1515
  }
1447
1516
  ]
1448
1517
  },
1449
- "FLAGGABLE_PROMPTS": {
1450
- "api-name": {
1451
- "message": "API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from.",
1452
- "promptMessage": "API name of the authoring bundle to publish"
1453
- }
1454
- },
1455
1518
  "isESM": true,
1456
1519
  "relativePath": [
1457
1520
  "lib",
1458
1521
  "commands",
1459
1522
  "agent",
1460
- "publish",
1461
- "authoring-bundle.js"
1523
+ "test",
1524
+ "resume.js"
1462
1525
  ],
1463
1526
  "aliasPermutations": [],
1464
1527
  "permutations": [
1465
- "agent:publish:authoring-bundle",
1466
- "publish:agent:authoring-bundle",
1467
- "publish:authoring-bundle:agent",
1468
- "agent:authoring-bundle:publish",
1469
- "authoring-bundle:agent:publish",
1470
- "authoring-bundle:publish: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"
1471
1534
  ]
1472
1535
  },
1473
- "agent:test:create": {
1536
+ "agent:test:run-eval": {
1474
1537
  "aliases": [],
1475
1538
  "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.",
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.",
1477
1540
  "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"
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"
1481
1547
  ],
1482
1548
  "flags": {
1483
1549
  "json": {
@@ -1495,20 +1561,6 @@
1495
1561
  "multiple": false,
1496
1562
  "type": "option"
1497
1563
  },
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
1564
  "target-org": {
1513
1565
  "char": "o",
1514
1566
  "name": "target-org",
@@ -1526,27 +1578,60 @@
1526
1578
  "multiple": false,
1527
1579
  "type": "option"
1528
1580
  },
1529
- "preview": {
1530
- "name": "preview",
1531
- "summary": "Preview the test metadata file (AiEvaluationDefinition) without deploying to your org.",
1532
- "allowNo": false,
1533
- "type": "boolean"
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"
1534
1589
  },
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.",
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.",
1538
1623
  "allowNo": false,
1539
1624
  "type": "boolean"
1540
1625
  }
1541
1626
  },
1542
1627
  "hasDynamicHelp": true,
1543
1628
  "hiddenAliases": [],
1544
- "id": "agent:test:create",
1629
+ "id": "agent:test:run-eval",
1545
1630
  "pluginAlias": "@salesforce/plugin-agent",
1546
1631
  "pluginName": "@salesforce/plugin-agent",
1547
1632
  "pluginType": "core",
1548
1633
  "strict": true,
1549
- "summary": "Create an agent test in your org using a local test spec YAML file.",
1634
+ "summary": "Run evaluation tests against an Agentforce agent.",
1550
1635
  "enableJsonFlag": true,
1551
1636
  "envVariablesSection": {
1552
1637
  "header": "ENVIRONMENT VARIABLES",
@@ -1562,19 +1647,19 @@
1562
1647
  "body": [
1563
1648
  {
1564
1649
  "name": "Succeeded (0)",
1565
- "description": "Test created and deployed successfully."
1650
+ "description": "Tests completed successfully. Test results (passed/failed) are in the JSON output."
1566
1651
  },
1567
1652
  {
1568
1653
  "name": "Failed (1)",
1569
- "description": "Test validation errors or metadata format issues."
1654
+ "description": "Tests encountered execution errors (tests couldn't run properly)."
1570
1655
  },
1571
1656
  {
1572
1657
  "name": "NotFound (2)",
1573
- "description": "Test spec file not found or org connection failed."
1658
+ "description": "Agent not found, spec file not found, or invalid agent name."
1574
1659
  },
1575
1660
  {
1576
- "name": "DeploymentFailed (4)",
1577
- "description": "Deployment failed due to API or network errors."
1661
+ "name": "OperationFailed (4)",
1662
+ "description": "Failed to execute tests due to API or network errors."
1578
1663
  }
1579
1664
  ]
1580
1665
  },
@@ -1584,25 +1669,26 @@
1584
1669
  "commands",
1585
1670
  "agent",
1586
1671
  "test",
1587
- "create.js"
1672
+ "run-eval.js"
1588
1673
  ],
1589
1674
  "aliasPermutations": [],
1590
1675
  "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"
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"
1597
1682
  ]
1598
1683
  },
1599
- "agent:test:list": {
1684
+ "agent:test:run": {
1600
1685
  "aliases": [],
1601
1686
  "args": {},
1602
- "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.",
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.",
1603
1688
  "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"
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"
1606
1692
  ],
1607
1693
  "flags": {
1608
1694
  "json": {
@@ -1636,108 +1722,23 @@
1636
1722
  "hasDynamicHelp": false,
1637
1723
  "multiple": false,
1638
1724
  "type": "option"
1639
- }
1640
- },
1641
- "hasDynamicHelp": true,
1642
- "hiddenAliases": [],
1643
- "id": "agent:test:list",
1644
- "pluginAlias": "@salesforce/plugin-agent",
1645
- "pluginName": "@salesforce/plugin-agent",
1646
- "pluginType": "core",
1647
- "strict": true,
1648
- "summary": "List the available agent tests in your org.",
1649
- "enableJsonFlag": true,
1650
- "envVariablesSection": {
1651
- "header": "ENVIRONMENT VARIABLES",
1652
- "body": [
1653
- {
1654
- "name": "SF_TARGET_ORG",
1655
- "description": "Username or alias of your default org. Overrides the target-org configuration variable."
1656
- }
1657
- ]
1658
- },
1659
- "errorCodes": {
1660
- "header": "ERROR CODES",
1661
- "body": [
1662
- {
1663
- "name": "Succeeded (0)",
1664
- "description": "Agent tests listed successfully."
1665
- },
1666
- {
1667
- "name": "Failed (4)",
1668
- "description": "Failed to retrieve agent tests due to API or network errors."
1669
- }
1670
- ]
1671
- },
1672
- "isESM": true,
1673
- "relativePath": [
1674
- "lib",
1675
- "commands",
1676
- "agent",
1677
- "test",
1678
- "list.js"
1679
- ],
1680
- "aliasPermutations": [],
1681
- "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"
1688
- ]
1689
- },
1690
- "agent:test:results": {
1691
- "aliases": [],
1692
- "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.",
1694
- "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"
1698
- ],
1699
- "flags": {
1700
- "json": {
1701
- "description": "Format output as json.",
1702
- "helpGroup": "GLOBAL",
1703
- "name": "json",
1704
- "allowNo": false,
1705
- "type": "boolean"
1706
1725
  },
1707
- "flags-dir": {
1708
- "helpGroup": "GLOBAL",
1709
- "name": "flags-dir",
1710
- "summary": "Import flag values from a directory.",
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.",
1711
1730
  "hasDynamicHelp": false,
1712
1731
  "multiple": false,
1713
1732
  "type": "option"
1714
1733
  },
1715
- "target-org": {
1716
- "char": "o",
1717
- "name": "target-org",
1718
- "noCacheDefault": true,
1719
- "required": true,
1720
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
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.",
1721
1738
  "hasDynamicHelp": true,
1722
1739
  "multiple": false,
1723
1740
  "type": "option"
1724
1741
  },
1725
- "api-version": {
1726
- "description": "Override the api version used for api requests made by this command",
1727
- "name": "api-version",
1728
- "hasDynamicHelp": false,
1729
- "multiple": false,
1730
- "type": "option"
1731
- },
1732
- "job-id": {
1733
- "char": "i",
1734
- "name": "job-id",
1735
- "required": true,
1736
- "summary": "Job ID of the completed agent test run.",
1737
- "hasDynamicHelp": false,
1738
- "multiple": false,
1739
- "type": "option"
1740
- },
1741
1742
  "result-format": {
1742
1743
  "name": "result-format",
1743
1744
  "summary": "Format of the agent test run results.",
@@ -1783,12 +1784,12 @@
1783
1784
  },
1784
1785
  "hasDynamicHelp": true,
1785
1786
  "hiddenAliases": [],
1786
- "id": "agent:test:results",
1787
+ "id": "agent:test:run",
1787
1788
  "pluginAlias": "@salesforce/plugin-agent",
1788
1789
  "pluginName": "@salesforce/plugin-agent",
1789
1790
  "pluginType": "core",
1790
1791
  "strict": true,
1791
- "summary": "Get the results of a completed agent test run.",
1792
+ "summary": "Start an agent test in your org.",
1792
1793
  "enableJsonFlag": true,
1793
1794
  "envVariablesSection": {
1794
1795
  "header": "ENVIRONMENT VARIABLES",
@@ -1804,15 +1805,19 @@
1804
1805
  "body": [
1805
1806
  {
1806
1807
  "name": "Succeeded (0)",
1807
- "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)."
1808
1813
  },
1809
1814
  {
1810
1815
  "name": "NotFound (2)",
1811
- "description": "Job ID not found or invalid."
1816
+ "description": "Test definition not found or invalid test name."
1812
1817
  },
1813
1818
  {
1814
- "name": "Failed (4)",
1815
- "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."
1816
1821
  }
1817
1822
  ]
1818
1823
  },
@@ -1822,26 +1827,26 @@
1822
1827
  "commands",
1823
1828
  "agent",
1824
1829
  "test",
1825
- "results.js"
1830
+ "run.js"
1826
1831
  ],
1827
1832
  "aliasPermutations": [],
1828
1833
  "permutations": [
1829
- "agent:test:results",
1830
- "test:agent:results",
1831
- "test:results:agent",
1832
- "agent:results:test",
1833
- "results:agent:test",
1834
- "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"
1835
1840
  ]
1836
1841
  },
1837
- "agent:test:resume": {
1842
+ "agent:preview:end": {
1838
1843
  "aliases": [],
1839
1844
  "args": {},
1840
- "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.",
1841
1846
  "examples": [
1842
- "Resume an agent test in your default org using a job ID:\n<%= config.bin %> <%= command.id %> --job-id 4KBfake0000003F4AQ",
1843
- "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",
1844
- "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"
1845
1850
  ],
1846
1851
  "flags": {
1847
1852
  "json": {
@@ -1876,82 +1881,40 @@
1876
1881
  "multiple": false,
1877
1882
  "type": "option"
1878
1883
  },
1879
- "job-id": {
1880
- "char": "i",
1881
- "name": "job-id",
1882
- "summary": "Job ID of the original agent test run.",
1883
- "hasDynamicHelp": false,
1884
- "multiple": false,
1885
- "type": "option"
1886
- },
1887
- "use-most-recent": {
1888
- "char": "r",
1889
- "name": "use-most-recent",
1890
- "summary": "Use the job ID of the most recent agent test run.",
1891
- "allowNo": false,
1892
- "type": "boolean"
1893
- },
1894
- "wait": {
1895
- "char": "w",
1896
- "name": "wait",
1897
- "summary": "Number of minutes to wait for the command to complete and display results to the terminal window.",
1898
- "default": "5 minutes",
1899
- "hasDynamicHelp": true,
1900
- "multiple": false,
1901
- "type": "option"
1902
- },
1903
- "result-format": {
1904
- "name": "result-format",
1905
- "summary": "Format of the agent test run results.",
1906
- "default": "human",
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.",
1907
1888
  "hasDynamicHelp": false,
1908
1889
  "multiple": false,
1909
- "options": [
1910
- "json",
1911
- "human",
1912
- "junit",
1913
- "tap"
1914
- ],
1915
1890
  "type": "option"
1916
1891
  },
1917
- "output-dir": {
1918
- "char": "d",
1919
- "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.",
1920
- "name": "output-dir",
1921
- "summary": "Directory to write the agent test results into.",
1892
+ "api-name": {
1893
+ "char": "n",
1894
+ "name": "api-name",
1895
+ "summary": "API name of the activated published agent you want to preview.",
1922
1896
  "hasDynamicHelp": false,
1923
1897
  "multiple": false,
1924
1898
  "type": "option"
1925
1899
  },
1926
- "test-runner": {
1927
- "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.",
1928
- "name": "test-runner",
1929
- "summary": "Explicitly specify which test runner to use (agentforce-studio or testing-center).",
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.",
1930
1903
  "hasDynamicHelp": false,
1931
1904
  "multiple": false,
1932
- "options": [
1933
- "agentforce-studio",
1934
- "testing-center"
1935
- ],
1936
1905
  "type": "option"
1937
- },
1938
- "verbose": {
1939
- "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.",
1940
- "name": "verbose",
1941
- "summary": "Show generated data in the test results output.",
1942
- "allowNo": false,
1943
- "type": "boolean"
1944
1906
  }
1945
1907
  },
1946
1908
  "hasDynamicHelp": true,
1947
1909
  "hiddenAliases": [],
1948
- "id": "agent:test:resume",
1910
+ "id": "agent:preview:end",
1949
1911
  "pluginAlias": "@salesforce/plugin-agent",
1950
1912
  "pluginName": "@salesforce/plugin-agent",
1951
1913
  "pluginType": "core",
1952
1914
  "strict": true,
1953
- "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.",
1954
1916
  "enableJsonFlag": true,
1917
+ "requiresProject": true,
1955
1918
  "envVariablesSection": {
1956
1919
  "header": "ENVIRONMENT VARIABLES",
1957
1920
  "body": [
@@ -1966,19 +1929,19 @@
1966
1929
  "body": [
1967
1930
  {
1968
1931
  "name": "Succeeded (0)",
1969
- "description": "Test completed successfully (with test results in the output)."
1932
+ "description": "Preview session ended successfully and traces saved."
1970
1933
  },
1971
1934
  {
1972
- "name": "Failed (1)",
1973
- "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."
1974
1937
  },
1975
1938
  {
1976
- "name": "NotFound (2)",
1977
- "description": "Job ID not found or invalid."
1939
+ "name": "PreviewEndFailed (4)",
1940
+ "description": "Failed to end the preview session."
1978
1941
  },
1979
1942
  {
1980
- "name": "OperationFailed (4)",
1981
- "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."
1982
1945
  }
1983
1946
  ]
1984
1947
  },
@@ -1987,30 +1950,27 @@
1987
1950
  "lib",
1988
1951
  "commands",
1989
1952
  "agent",
1990
- "test",
1991
- "resume.js"
1953
+ "preview",
1954
+ "end.js"
1992
1955
  ],
1993
1956
  "aliasPermutations": [],
1994
1957
  "permutations": [
1995
- "agent:test:resume",
1996
- "test:agent:resume",
1997
- "test:resume:agent",
1998
- "agent:resume:test",
1999
- "resume:agent:test",
2000
- "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"
2001
1964
  ]
2002
1965
  },
2003
- "agent:test:run-eval": {
1966
+ "agent:preview:send": {
2004
1967
  "aliases": [],
2005
1968
  "args": {},
2006
- "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.",
2007
1970
  "examples": [
2008
- "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",
2009
- "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",
2010
- "Run tests using a JSON payload:\n<%= config.bin %> <%= command.id %> --spec tests/eval-payload.json --target-org my-org",
2011
- "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",
2012
- "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",
2013
- "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"
2014
1974
  ],
2015
1975
  "flags": {
2016
1976
  "json": {
@@ -2045,72 +2005,49 @@
2045
2005
  "multiple": false,
2046
2006
  "type": "option"
2047
2007
  },
2048
- "spec": {
2049
- "char": "s",
2050
- "name": "spec",
2051
- "required": true,
2052
- "summary": "Path to test spec file (YAML or JSON). Supports reading from stdin when piping content.",
2053
- "hasDynamicHelp": false,
2054
- "multiple": false,
2055
- "type": "option"
2056
- },
2057
- "api-name": {
2058
- "char": "n",
2059
- "name": "api-name",
2060
- "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.",
2061
2012
  "hasDynamicHelp": false,
2062
2013
  "multiple": false,
2063
2014
  "type": "option"
2064
2015
  },
2065
- "wait": {
2066
- "char": "w",
2067
- "name": "wait",
2068
- "summary": "Number of minutes to wait for results.",
2069
- "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.",
2070
2021
  "hasDynamicHelp": false,
2071
2022
  "multiple": false,
2072
2023
  "type": "option"
2073
2024
  },
2074
- "result-format": {
2075
- "name": "result-format",
2076
- "summary": "Format of the agent test run results.",
2077
- "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.",
2078
2029
  "hasDynamicHelp": false,
2079
2030
  "multiple": false,
2080
- "options": [
2081
- "json",
2082
- "human",
2083
- "junit",
2084
- "tap"
2085
- ],
2086
2031
  "type": "option"
2087
2032
  },
2088
- "batch-size": {
2089
- "name": "batch-size",
2090
- "summary": "Number of tests per API request (max 5).",
2091
- "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.",
2092
2036
  "hasDynamicHelp": false,
2093
2037
  "multiple": false,
2094
2038
  "type": "option"
2095
- },
2096
- "no-normalize": {
2097
- "name": "no-normalize",
2098
- "summary": "Disable auto-normalization of field names and shorthand references.",
2099
- "allowNo": false,
2100
- "type": "boolean"
2101
2039
  }
2102
2040
  },
2103
2041
  "hasDynamicHelp": true,
2104
- "hidden": true,
2105
2042
  "hiddenAliases": [],
2106
- "id": "agent:test:run-eval",
2043
+ "id": "agent:preview:send",
2107
2044
  "pluginAlias": "@salesforce/plugin-agent",
2108
2045
  "pluginName": "@salesforce/plugin-agent",
2109
2046
  "pluginType": "core",
2110
- "state": "beta",
2111
2047
  "strict": true,
2112
- "summary": "Run evaluation tests against an Agentforce agent.",
2048
+ "summary": "Send a message to an existing agent preview session.",
2113
2049
  "enableJsonFlag": true,
2050
+ "requiresProject": true,
2114
2051
  "envVariablesSection": {
2115
2052
  "header": "ENVIRONMENT VARIABLES",
2116
2053
  "body": [
@@ -2125,19 +2062,19 @@
2125
2062
  "body": [
2126
2063
  {
2127
2064
  "name": "Succeeded (0)",
2128
- "description": "Tests completed successfully. Test results (passed/failed) are in the JSON output."
2065
+ "description": "Message sent successfully and agent response received."
2129
2066
  },
2130
2067
  {
2131
- "name": "Failed (1)",
2132
- "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."
2133
2070
  },
2134
2071
  {
2135
- "name": "NotFound (2)",
2136
- "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."
2137
2074
  },
2138
2075
  {
2139
- "name": "OperationFailed (4)",
2140
- "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."
2141
2078
  }
2142
2079
  ]
2143
2080
  },
@@ -2146,27 +2083,88 @@
2146
2083
  "lib",
2147
2084
  "commands",
2148
2085
  "agent",
2149
- "test",
2150
- "run-eval.js"
2086
+ "preview",
2087
+ "send.js"
2151
2088
  ],
2152
2089
  "aliasPermutations": [],
2153
2090
  "permutations": [
2154
- "agent:test:run-eval",
2155
- "test:agent:run-eval",
2156
- "test:run-eval:agent",
2157
- "agent:run-eval:test",
2158
- "run-eval:agent:test",
2159
- "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"
2160
2097
  ]
2161
2098
  },
2162
- "agent:test:run": {
2099
+ "agent:preview:sessions": {
2163
2100
  "aliases": [],
2164
2101
  "args": {},
2165
- "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.",
2166
2103
  "examples": [
2167
- "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",
2168
- "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",
2169
- "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"
2170
2168
  ],
2171
2169
  "flags": {
2172
2170
  "json": {
@@ -2204,71 +2202,58 @@
2204
2202
  "api-name": {
2205
2203
  "char": "n",
2206
2204
  "name": "api-name",
2207
- "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.",
2208
2206
  "hasDynamicHelp": false,
2209
2207
  "multiple": false,
2210
2208
  "type": "option"
2211
2209
  },
2212
- "wait": {
2213
- "char": "w",
2214
- "name": "wait",
2215
- "summary": "Number of minutes to wait for the command to complete and display results to the terminal window.",
2216
- "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,
2217
2214
  "multiple": false,
2218
2215
  "type": "option"
2219
2216
  },
2220
- "result-format": {
2221
- "name": "result-format",
2222
- "summary": "Format of the agent test run results.",
2223
- "default": "human",
2224
- "hasDynamicHelp": false,
2225
- "multiple": false,
2226
- "options": [
2227
- "json",
2228
- "human",
2229
- "junit",
2230
- "tap"
2217
+ "use-live-actions": {
2218
+ "exclusive": [
2219
+ "simulate-actions"
2231
2220
  ],
2232
- "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"
2233
2225
  },
2234
- "output-dir": {
2235
- "char": "d",
2236
- "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.",
2237
- "name": "output-dir",
2238
- "summary": "Directory to write the agent test results into.",
2239
- "hasDynamicHelp": false,
2240
- "multiple": false,
2241
- "type": "option"
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"
2242
2234
  },
2243
- "test-runner": {
2244
- "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.",
2245
- "name": "test-runner",
2246
- "summary": "Explicitly specify which test runner to use (agentforce-studio or testing-center).",
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.",
2247
2242
  "hasDynamicHelp": false,
2248
2243
  "multiple": false,
2249
- "options": [
2250
- "agentforce-studio",
2251
- "testing-center"
2252
- ],
2253
2244
  "type": "option"
2254
- },
2255
- "verbose": {
2256
- "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.",
2257
- "name": "verbose",
2258
- "summary": "Show generated data in the test results output.",
2259
- "allowNo": false,
2260
- "type": "boolean"
2261
2245
  }
2262
2246
  },
2263
2247
  "hasDynamicHelp": true,
2264
2248
  "hiddenAliases": [],
2265
- "id": "agent:test:run",
2249
+ "id": "agent:preview:start",
2266
2250
  "pluginAlias": "@salesforce/plugin-agent",
2267
2251
  "pluginName": "@salesforce/plugin-agent",
2268
2252
  "pluginType": "core",
2269
2253
  "strict": true,
2270
- "summary": "Start an agent test in your org.",
2254
+ "summary": "Start a programmatic agent preview session.",
2271
2255
  "enableJsonFlag": true,
2256
+ "requiresProject": true,
2272
2257
  "envVariablesSection": {
2273
2258
  "header": "ENVIRONMENT VARIABLES",
2274
2259
  "body": [
@@ -2283,19 +2268,23 @@
2283
2268
  "body": [
2284
2269
  {
2285
2270
  "name": "Succeeded (0)",
2286
- "description": "Test started successfully (without --wait), or test completed successfully (with --wait)."
2271
+ "description": "Preview session started successfully."
2287
2272
  },
2288
2273
  {
2289
2274
  "name": "Failed (1)",
2290
- "description": "Tests encountered execution errors (test cases with ERROR status when using --wait)."
2275
+ "description": "Agent Script compilation failed (syntax errors in the script)."
2291
2276
  },
2292
2277
  {
2293
2278
  "name": "NotFound (2)",
2294
- "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)."
2295
2280
  },
2296
2281
  {
2297
- "name": "OperationFailed (4)",
2298
- "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."
2299
2288
  }
2300
2289
  ]
2301
2290
  },
@@ -2304,17 +2293,17 @@
2304
2293
  "lib",
2305
2294
  "commands",
2306
2295
  "agent",
2307
- "test",
2308
- "run.js"
2296
+ "preview",
2297
+ "start.js"
2309
2298
  ],
2310
2299
  "aliasPermutations": [],
2311
2300
  "permutations": [
2312
- "agent:test:run",
2313
- "test:agent:run",
2314
- "test:run:agent",
2315
- "agent:run:test",
2316
- "run:agent:test",
2317
- "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"
2318
2307
  ]
2319
2308
  },
2320
2309
  "agent:validate:authoring-bundle": {
@@ -2432,5 +2421,5 @@
2432
2421
  ]
2433
2422
  }
2434
2423
  },
2435
- "version": "1.36.1"
2424
+ "version": "1.37.0"
2436
2425
  }