@salesforce/plugin-agent 1.40.0 → 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.
@@ -879,16 +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, 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.",
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",
890
- "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",
891
- "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>"
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"
892
891
  ],
893
892
  "flags": {
894
893
  "json": {
@@ -923,129 +922,95 @@
923
922
  "multiple": false,
924
923
  "type": "option"
925
924
  },
926
- "session-id": {
927
- "exclusive": [
928
- "all"
929
- ],
930
- "name": "session-id",
931
- "required": false,
932
- "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.",
933
- "hasDynamicHelp": false,
934
- "multiple": false,
935
- "type": "option"
936
- },
937
925
  "api-name": {
938
926
  "char": "n",
939
- "exclusive": [
940
- "authoring-bundle"
941
- ],
942
927
  "name": "api-name",
943
- "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.",
944
929
  "hasDynamicHelp": false,
945
930
  "multiple": false,
946
931
  "type": "option"
947
932
  },
948
- "authoring-bundle": {
949
- "exclusive": [
950
- "api-name"
951
- ],
952
- "name": "authoring-bundle",
953
- "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
954
- "hasDynamicHelp": false,
955
- "multiple": false,
956
- "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"
957
938
  },
958
- "all": {
939
+ "verbose": {
940
+ "char": "v",
959
941
  "exclusive": [
960
- "session-id"
942
+ "concise"
961
943
  ],
962
- "name": "all",
963
- "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.",
944
+ "name": "verbose",
945
+ "summary": "Display detailed output showing all metadata components retrieved and deployed during the publish process.",
964
946
  "allowNo": false,
965
947
  "type": "boolean"
966
948
  },
967
- "no-prompt": {
968
- "char": "p",
969
- "name": "no-prompt",
970
- "summary": "Don't prompt for confirmation before ending sessions. Has an effect only when used with --all.",
949
+ "concise": {
950
+ "exclusive": [
951
+ "verbose"
952
+ ],
953
+ "name": "concise",
954
+ "summary": "Display minimal output with only essential information about the publish operation.",
971
955
  "allowNo": false,
972
956
  "type": "boolean"
973
957
  }
974
958
  },
975
959
  "hasDynamicHelp": true,
976
960
  "hiddenAliases": [],
977
- "id": "agent:preview:end",
961
+ "id": "agent:publish:authoring-bundle",
978
962
  "pluginAlias": "@salesforce/plugin-agent",
979
963
  "pluginName": "@salesforce/plugin-agent",
980
964
  "pluginType": "core",
981
965
  "strict": true,
982
- "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.",
983
967
  "enableJsonFlag": true,
984
968
  "requiresProject": true,
985
- "envVariablesSection": {
986
- "header": "ENVIRONMENT VARIABLES",
987
- "body": [
988
- {
989
- "name": "SF_TARGET_ORG",
990
- "description": "Username or alias of your default org. Overrides the target-org configuration variable."
991
- }
992
- ]
993
- },
994
969
  "errorCodes": {
995
970
  "header": "ERROR CODES",
996
971
  "body": [
997
972
  {
998
973
  "name": "Succeeded (0)",
999
- "description": "Preview session ended successfully and traces saved."
1000
- },
1001
- {
1002
- "name": "ExactlyOneRequired (2)",
1003
- "description": "Neither --api-name nor --authoring-bundle was provided (required when --all is not set)."
1004
- },
1005
- {
1006
- "name": "NotFound (2)",
1007
- "description": "Agent not found, or no preview session exists for this agent."
1008
- },
1009
- {
1010
- "name": "PreviewEndFailed (4)",
1011
- "description": "Failed to end the preview session."
1012
- },
1013
- {
1014
- "name": "PreviewEndPartialFailure (68)",
1015
- "description": "With --all, one or more sessions failed to end while others succeeded."
974
+ "description": "Agent published successfully without errors."
1016
975
  },
1017
976
  {
1018
- "name": "SessionAmbiguous (5)",
1019
- "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."
1020
979
  }
1021
980
  ]
1022
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
+ },
1023
988
  "isESM": true,
1024
989
  "relativePath": [
1025
990
  "lib",
1026
991
  "commands",
1027
992
  "agent",
1028
- "preview",
1029
- "end.js"
993
+ "publish",
994
+ "authoring-bundle.js"
1030
995
  ],
1031
996
  "aliasPermutations": [],
1032
997
  "permutations": [
1033
- "agent:preview:end",
1034
- "preview:agent:end",
1035
- "preview:end:agent",
1036
- "agent:end:preview",
1037
- "end:agent:preview",
1038
- "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"
1039
1004
  ]
1040
1005
  },
1041
- "agent:preview:send": {
1006
+ "agent:test:create": {
1042
1007
  "aliases": [],
1043
1008
  "args": {},
1044
- "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.",
1045
1010
  "examples": [
1046
- "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>",
1047
- "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",
1048
- "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"
1049
1014
  ],
1050
1015
  "flags": {
1051
1016
  "json": {
@@ -1063,6 +1028,20 @@
1063
1028
  "multiple": false,
1064
1029
  "type": "option"
1065
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
+ },
1066
1045
  "target-org": {
1067
1046
  "char": "o",
1068
1047
  "name": "target-org",
@@ -1080,49 +1059,28 @@
1080
1059
  "multiple": false,
1081
1060
  "type": "option"
1082
1061
  },
1083
- "session-id": {
1084
- "name": "session-id",
1085
- "required": false,
1086
- "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.",
1087
- "hasDynamicHelp": false,
1088
- "multiple": false,
1089
- "type": "option"
1090
- },
1091
- "utterance": {
1092
- "char": "u",
1093
- "name": "utterance",
1094
- "required": true,
1095
- "summary": "Utterance to send to the agent, enclosed in double quotes.",
1096
- "hasDynamicHelp": false,
1097
- "multiple": false,
1098
- "type": "option"
1099
- },
1100
- "api-name": {
1101
- "char": "n",
1102
- "name": "api-name",
1103
- "summary": "API name of the activated published agent you want to preview.",
1104
- "hasDynamicHelp": false,
1105
- "multiple": false,
1106
- "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"
1107
1067
  },
1108
- "authoring-bundle": {
1109
- "name": "authoring-bundle",
1110
- "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
1111
- "hasDynamicHelp": false,
1112
- "multiple": false,
1113
- "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"
1114
1073
  }
1115
1074
  },
1116
1075
  "hasDynamicHelp": true,
1117
1076
  "hiddenAliases": [],
1118
- "id": "agent:preview:send",
1077
+ "id": "agent:test:create",
1119
1078
  "pluginAlias": "@salesforce/plugin-agent",
1120
1079
  "pluginName": "@salesforce/plugin-agent",
1121
1080
  "pluginType": "core",
1122
1081
  "strict": true,
1123
- "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.",
1124
1083
  "enableJsonFlag": true,
1125
- "requiresProject": true,
1126
1084
  "envVariablesSection": {
1127
1085
  "header": "ENVIRONMENT VARIABLES",
1128
1086
  "body": [
@@ -1137,19 +1095,19 @@
1137
1095
  "body": [
1138
1096
  {
1139
1097
  "name": "Succeeded (0)",
1140
- "description": "Message sent successfully and agent response received."
1098
+ "description": "Test created and deployed successfully."
1141
1099
  },
1142
1100
  {
1143
- "name": "NotFound (2)",
1144
- "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."
1145
1103
  },
1146
1104
  {
1147
- "name": "PreviewSendFailed (4)",
1148
- "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."
1149
1107
  },
1150
1108
  {
1151
- "name": "SessionAmbiguous (5)",
1152
- "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."
1153
1111
  }
1154
1112
  ]
1155
1113
  },
@@ -1158,25 +1116,26 @@
1158
1116
  "lib",
1159
1117
  "commands",
1160
1118
  "agent",
1161
- "preview",
1162
- "send.js"
1119
+ "test",
1120
+ "create.js"
1163
1121
  ],
1164
1122
  "aliasPermutations": [],
1165
1123
  "permutations": [
1166
- "agent:preview:send",
1167
- "preview:agent:send",
1168
- "preview:send:agent",
1169
- "agent:send:preview",
1170
- "send:agent:preview",
1171
- "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"
1172
1130
  ]
1173
1131
  },
1174
- "agent:preview:sessions": {
1132
+ "agent:test:list": {
1175
1133
  "aliases": [],
1176
1134
  "args": {},
1177
- "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.",
1178
1136
  "examples": [
1179
- "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"
1180
1139
  ],
1181
1140
  "flags": {
1182
1141
  "json": {
@@ -1193,25 +1152,54 @@
1193
1152
  "hasDynamicHelp": false,
1194
1153
  "multiple": false,
1195
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"
1196
1172
  }
1197
1173
  },
1198
- "hasDynamicHelp": false,
1174
+ "hasDynamicHelp": true,
1199
1175
  "hiddenAliases": [],
1200
- "id": "agent:preview:sessions",
1176
+ "id": "agent:test:list",
1201
1177
  "pluginAlias": "@salesforce/plugin-agent",
1202
1178
  "pluginName": "@salesforce/plugin-agent",
1203
1179
  "pluginType": "core",
1204
1180
  "strict": true,
1205
- "summary": "List all known programmatic agent preview sessions.",
1181
+ "summary": "List the available agent tests in your org.",
1206
1182
  "enableJsonFlag": true,
1207
- "requiresProject": true,
1208
- "errorCodes": {
1209
- "header": "ERROR CODES",
1183
+ "envVariablesSection": {
1184
+ "header": "ENVIRONMENT VARIABLES",
1210
1185
  "body": [
1211
1186
  {
1212
- "name": "Succeeded (0)",
1213
- "description": "Sessions listed successfully (or empty list if no active sessions)."
1214
- }
1187
+ "name": "SF_TARGET_ORG",
1188
+ "description": "Username or alias of your default org. Overrides the target-org configuration variable."
1189
+ }
1190
+ ]
1191
+ },
1192
+ "errorCodes": {
1193
+ "header": "ERROR CODES",
1194
+ "body": [
1195
+ {
1196
+ "name": "Succeeded (0)",
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."
1202
+ }
1215
1203
  ]
1216
1204
  },
1217
1205
  "isESM": true,
@@ -1219,27 +1207,27 @@
1219
1207
  "lib",
1220
1208
  "commands",
1221
1209
  "agent",
1222
- "preview",
1223
- "sessions.js"
1210
+ "test",
1211
+ "list.js"
1224
1212
  ],
1225
1213
  "aliasPermutations": [],
1226
1214
  "permutations": [
1227
- "agent:preview:sessions",
1228
- "preview:agent:sessions",
1229
- "preview:sessions:agent",
1230
- "agent:sessions:preview",
1231
- "sessions:agent:preview",
1232
- "sessions:preview:agent"
1215
+ "agent:test:list",
1216
+ "test:agent:list",
1217
+ "test:list:agent",
1218
+ "agent:list:test",
1219
+ "list:agent:test",
1220
+ "list:test:agent"
1233
1221
  ]
1234
1222
  },
1235
- "agent:preview:start": {
1223
+ "agent:test:results": {
1236
1224
  "aliases": [],
1237
1225
  "args": {},
1238
- "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.",
1239
1227
  "examples": [
1240
- "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",
1241
- "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",
1242
- "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"
1243
1231
  ],
1244
1232
  "flags": {
1245
1233
  "json": {
@@ -1274,61 +1262,67 @@
1274
1262
  "multiple": false,
1275
1263
  "type": "option"
1276
1264
  },
1277
- "api-name": {
1278
- "char": "n",
1279
- "name": "api-name",
1280
- "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.",
1281
1270
  "hasDynamicHelp": false,
1282
1271
  "multiple": false,
1283
1272
  "type": "option"
1284
1273
  },
1285
- "authoring-bundle": {
1286
- "name": "authoring-bundle",
1287
- "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",
1288
1278
  "hasDynamicHelp": false,
1289
1279
  "multiple": false,
1290
- "type": "option"
1291
- },
1292
- "use-live-actions": {
1293
- "exclusive": [
1294
- "simulate-actions"
1280
+ "options": [
1281
+ "json",
1282
+ "human",
1283
+ "junit",
1284
+ "tap"
1295
1285
  ],
1296
- "name": "use-live-actions",
1297
- "summary": "Execute real actions in the org (Apex classes, flows, etc.). Required with --authoring-bundle.",
1298
- "allowNo": false,
1299
- "type": "boolean"
1286
+ "type": "option"
1300
1287
  },
1301
- "simulate-actions": {
1302
- "exclusive": [
1303
- "use-live-actions"
1304
- ],
1305
- "name": "simulate-actions",
1306
- "summary": "Use AI to simulate action execution instead of calling real actions. Required with --authoring-bundle.",
1307
- "allowNo": false,
1308
- "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"
1309
1296
  },
1310
- "agent-json": {
1311
- "dependsOn": [
1312
- "authoring-bundle"
1313
- ],
1314
- "hidden": true,
1315
- "name": "agent-json",
1316
- "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).",
1317
1301
  "hasDynamicHelp": false,
1318
1302
  "multiple": false,
1303
+ "options": [
1304
+ "agentforce-studio",
1305
+ "testing-center"
1306
+ ],
1319
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"
1320
1315
  }
1321
1316
  },
1322
1317
  "hasDynamicHelp": true,
1323
1318
  "hiddenAliases": [],
1324
- "id": "agent:preview:start",
1319
+ "id": "agent:test:results",
1325
1320
  "pluginAlias": "@salesforce/plugin-agent",
1326
1321
  "pluginName": "@salesforce/plugin-agent",
1327
1322
  "pluginType": "core",
1328
1323
  "strict": true,
1329
- "summary": "Start a programmatic agent preview session.",
1324
+ "summary": "Get the results of a completed agent test run.",
1330
1325
  "enableJsonFlag": true,
1331
- "requiresProject": true,
1332
1326
  "envVariablesSection": {
1333
1327
  "header": "ENVIRONMENT VARIABLES",
1334
1328
  "body": [
@@ -1343,23 +1337,15 @@
1343
1337
  "body": [
1344
1338
  {
1345
1339
  "name": "Succeeded (0)",
1346
- "description": "Preview session started successfully."
1347
- },
1348
- {
1349
- "name": "Failed (1)",
1350
- "description": "Agent Script compilation failed (syntax errors in the script)."
1340
+ "description": "Results retrieved successfully. Test results (passed/failed) are in the output."
1351
1341
  },
1352
1342
  {
1353
1343
  "name": "NotFound (2)",
1354
- "description": "Agent not found, or compilation API returned HTTP 404 (endpoint may not be available in your org or region)."
1355
- },
1356
- {
1357
- "name": "ServerError (3)",
1358
- "description": "Compilation API returned HTTP 500 (server error during compilation)."
1344
+ "description": "Job ID not found or invalid."
1359
1345
  },
1360
1346
  {
1361
- "name": "PreviewStartFailed (4)",
1362
- "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."
1363
1349
  }
1364
1350
  ]
1365
1351
  },
@@ -1368,28 +1354,27 @@
1368
1354
  "lib",
1369
1355
  "commands",
1370
1356
  "agent",
1371
- "preview",
1372
- "start.js"
1357
+ "test",
1358
+ "results.js"
1373
1359
  ],
1374
1360
  "aliasPermutations": [],
1375
1361
  "permutations": [
1376
- "agent:preview:start",
1377
- "preview:agent:start",
1378
- "preview:start:agent",
1379
- "agent:start:preview",
1380
- "start:agent:preview",
1381
- "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"
1382
1368
  ]
1383
1369
  },
1384
- "agent:publish:authoring-bundle": {
1370
+ "agent:test:resume": {
1385
1371
  "aliases": [],
1386
1372
  "args": {},
1387
- "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.",
1388
1374
  "examples": [
1389
- "Publish an authoring bundle by being prompted for its API name; use your default org:\n<%= config.bin %> <%= command.id %>",
1390
- "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",
1391
- "Publish with verbose output to see all retrieved and deployed metadata components:\n<%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --verbose",
1392
- "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"
1393
1378
  ],
1394
1379
  "flags": {
1395
1380
  "json": {
@@ -1424,164 +1409,81 @@
1424
1409
  "multiple": false,
1425
1410
  "type": "option"
1426
1411
  },
1427
- "api-name": {
1428
- "char": "n",
1429
- "name": "api-name",
1430
- "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.",
1431
1416
  "hasDynamicHelp": false,
1432
1417
  "multiple": false,
1433
1418
  "type": "option"
1434
1419
  },
1435
- "skip-retrieve": {
1436
- "name": "skip-retrieve",
1437
- "summary": "Don't retrieve the metadata associated with the agent to your DX project.",
1438
- "allowNo": false,
1439
- "type": "boolean"
1440
- },
1441
- "verbose": {
1442
- "char": "v",
1443
- "exclusive": [
1444
- "concise"
1445
- ],
1446
- "name": "verbose",
1447
- "summary": "Display detailed output showing all metadata components retrieved and deployed during the publish process.",
1448
- "allowNo": false,
1449
- "type": "boolean"
1450
- },
1451
- "concise": {
1452
- "exclusive": [
1453
- "verbose"
1454
- ],
1455
- "name": "concise",
1456
- "summary": "Display minimal output with only essential information about the publish operation.",
1457
- "allowNo": false,
1458
- "type": "boolean"
1459
- }
1460
- },
1461
- "hasDynamicHelp": true,
1462
- "hiddenAliases": [],
1463
- "id": "agent:publish:authoring-bundle",
1464
- "pluginAlias": "@salesforce/plugin-agent",
1465
- "pluginName": "@salesforce/plugin-agent",
1466
- "pluginType": "core",
1467
- "strict": true,
1468
- "summary": "Publish an authoring bundle to your org, which results in a new agent or a new version of an existing agent.",
1469
- "enableJsonFlag": true,
1470
- "requiresProject": true,
1471
- "errorCodes": {
1472
- "header": "ERROR CODES",
1473
- "body": [
1474
- {
1475
- "name": "Succeeded (0)",
1476
- "description": "Agent published successfully without errors."
1477
- },
1478
- {
1479
- "name": "Failed (1)",
1480
- "description": "Compilation errors found in the Agent Script file."
1481
- }
1482
- ]
1483
- },
1484
- "FLAGGABLE_PROMPTS": {
1485
- "api-name": {
1486
- "message": "API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from.",
1487
- "promptMessage": "API name of the authoring bundle to publish"
1488
- }
1489
- },
1490
- "isESM": true,
1491
- "relativePath": [
1492
- "lib",
1493
- "commands",
1494
- "agent",
1495
- "publish",
1496
- "authoring-bundle.js"
1497
- ],
1498
- "aliasPermutations": [],
1499
- "permutations": [
1500
- "agent:publish:authoring-bundle",
1501
- "publish:agent:authoring-bundle",
1502
- "publish:authoring-bundle:agent",
1503
- "agent:authoring-bundle:publish",
1504
- "authoring-bundle:agent:publish",
1505
- "authoring-bundle:publish:agent"
1506
- ]
1507
- },
1508
- "agent:test:create": {
1509
- "aliases": [],
1510
- "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.",
1512
- "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"
1516
- ],
1517
- "flags": {
1518
- "json": {
1519
- "description": "Format output as json.",
1520
- "helpGroup": "GLOBAL",
1521
- "name": "json",
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.",
1522
1424
  "allowNo": false,
1523
1425
  "type": "boolean"
1524
1426
  },
1525
- "flags-dir": {
1526
- "helpGroup": "GLOBAL",
1527
- "name": "flags-dir",
1528
- "summary": "Import flag values from a directory.",
1529
- "hasDynamicHelp": false,
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,
1530
1433
  "multiple": false,
1531
1434
  "type": "option"
1532
1435
  },
1533
- "api-name": {
1534
- "name": "api-name",
1535
- "summary": "API name of the new test; the API name must not exist in the org.",
1436
+ "result-format": {
1437
+ "name": "result-format",
1438
+ "summary": "Format of the agent test run results.",
1439
+ "default": "human",
1536
1440
  "hasDynamicHelp": false,
1537
1441
  "multiple": false,
1442
+ "options": [
1443
+ "json",
1444
+ "human",
1445
+ "junit",
1446
+ "tap"
1447
+ ],
1538
1448
  "type": "option"
1539
1449
  },
1540
- "spec": {
1541
- "name": "spec",
1542
- "summary": "Path to the test spec YAML file.",
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.",
1543
1455
  "hasDynamicHelp": false,
1544
1456
  "multiple": false,
1545
1457
  "type": "option"
1546
1458
  },
1547
- "target-org": {
1548
- "char": "o",
1549
- "name": "target-org",
1550
- "noCacheDefault": true,
1551
- "required": true,
1552
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
1553
- "hasDynamicHelp": true,
1554
- "multiple": false,
1555
- "type": "option"
1556
- },
1557
- "api-version": {
1558
- "description": "Override the api version used for api requests made by this command",
1559
- "name": "api-version",
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).",
1560
1463
  "hasDynamicHelp": false,
1561
1464
  "multiple": false,
1465
+ "options": [
1466
+ "agentforce-studio",
1467
+ "testing-center"
1468
+ ],
1562
1469
  "type": "option"
1563
1470
  },
1564
- "preview": {
1565
- "name": "preview",
1566
- "summary": "Preview the test metadata file (AiEvaluationDefinition) without deploying to your org.",
1567
- "allowNo": false,
1568
- "type": "boolean"
1569
- },
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.",
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": {
@@ -1655,32 +1561,78 @@
1655
1561
  "multiple": false,
1656
1562
  "type": "option"
1657
1563
  },
1658
- "target-org": {
1659
- "char": "o",
1660
- "name": "target-org",
1661
- "noCacheDefault": true,
1662
- "required": true,
1663
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
1664
- "hasDynamicHelp": true,
1665
- "multiple": false,
1666
- "type": "option"
1667
- },
1668
- "api-version": {
1669
- "description": "Override the api version used for api requests made by this command",
1670
- "name": "api-version",
1564
+ "target-org": {
1565
+ "char": "o",
1566
+ "name": "target-org",
1567
+ "noCacheDefault": true,
1568
+ "required": true,
1569
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
1570
+ "hasDynamicHelp": true,
1571
+ "multiple": false,
1572
+ "type": "option"
1573
+ },
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": "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.",
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 tests/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 tests/my-agent-testSpec.yaml --api-name My_Agent --target-org my-org",
2045
- "Run tests using a JSON payload:\n<%= config.bin %> <%= command.id %> --spec tests/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 tests/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 tests/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 DeveloperName (also called API name) 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 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.0"
2747
+ "version": "1.40.2"
2748
2748
  }