@salesforce/plugin-agent 1.38.1 → 1.39.1

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.
package/README.md CHANGED
@@ -130,7 +130,7 @@ EXAMPLES
130
130
  $ sf agent activate --api-name Resort_Manager --version 2 --target-org my-org
131
131
  ```
132
132
 
133
- _See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/activate.ts)_
133
+ _See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/activate.ts)_
134
134
 
135
135
  ## `sf agent create`
136
136
 
@@ -197,7 +197,7 @@ EXAMPLES
197
197
  $ sf agent create --name "Resort Manager" --spec specs/resortManagerAgent.yaml --preview
198
198
  ```
199
199
 
200
- _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/create.ts)_
200
+ _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/create.ts)_
201
201
 
202
202
  ## `sf agent deactivate`
203
203
 
@@ -238,7 +238,7 @@ EXAMPLES
238
238
  $ sf agent deactivate --api-name Resort_Manager --target-org my-org
239
239
  ```
240
240
 
241
- _See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/deactivate.ts)_
241
+ _See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/deactivate.ts)_
242
242
 
243
243
  ## `sf agent generate agent-spec`
244
244
 
@@ -345,7 +345,7 @@ EXAMPLES
345
345
  $ sf agent generate agent-spec --tone formal --agent-user resortmanager@myorg.com
346
346
  ```
347
347
 
348
- _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/generate/agent-spec.ts)_
348
+ _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/generate/agent-spec.ts)_
349
349
 
350
350
  ## `sf agent generate authoring-bundle`
351
351
 
@@ -422,7 +422,7 @@ EXAMPLES
422
422
  other-package-dir/main/default --target-org my-dev-org
423
423
  ```
424
424
 
425
- _See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/generate/authoring-bundle.ts)_
425
+ _See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/generate/authoring-bundle.ts)_
426
426
 
427
427
  ## `sf agent generate template`
428
428
 
@@ -484,7 +484,7 @@ EXAMPLES
484
484
  my-package --source-org my-scratch-org
485
485
  ```
486
486
 
487
- _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/generate/template.ts)_
487
+ _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/generate/template.ts)_
488
488
 
489
489
  ## `sf agent generate test-spec`
490
490
 
@@ -549,7 +549,7 @@ EXAMPLES
549
549
  force-app//main/default/aiEvaluationDefinitions/Resort_Manager_Tests.aiEvaluationDefinition-meta.xml
550
550
  ```
551
551
 
552
- _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/generate/test-spec.ts)_
552
+ _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/generate/test-spec.ts)_
553
553
 
554
554
  ## `sf agent preview`
555
555
 
@@ -622,7 +622,7 @@ EXAMPLES
622
622
  $ sf agent preview --use-live-actions --apex-debug --output-dir transcripts/my-preview
623
623
  ```
624
624
 
625
- _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/preview.ts)_
625
+ _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/preview.ts)_
626
626
 
627
627
  ## `sf agent preview end`
628
628
 
@@ -630,13 +630,18 @@ End an existing programmatic agent preview session and get trace location.
630
630
 
631
631
  ```
632
632
  USAGE
633
- $ sf agent preview end -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [--session-id <value>] [-n
634
- <value>] [--authoring-bundle <value>]
633
+ $ sf agent preview end -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [--session-id <value> |
634
+ --all] [-n <value> | --authoring-bundle <value>] [-p]
635
635
 
636
636
  FLAGS
637
637
  -n, --api-name=<value> API name of the activated published agent you want to preview.
638
638
  -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
639
639
  configuration variable is already set.
640
+ -p, --no-prompt Don't prompt for confirmation before ending sessions. Has an effect only when used
641
+ with --all.
642
+ --all End all active preview sessions. Combine with --api-name or --authoring-bundle to
643
+ limit to a specific agent, or use with only --target-org to end sessions for all
644
+ agents found in the local session cache. Requires --target-org.
640
645
  --api-version=<value> Override the api version used for api requests made by this command
641
646
  --authoring-bundle=<value> API name of the authoring bundle metadata component that contains the agent's Agent
642
647
  Script file.
@@ -656,13 +661,17 @@ DESCRIPTION
656
661
  The original "agent preview start" command outputs a session ID which you then use with the --session-id flag of this
657
662
  command to end the session. You don't have to specify the --session-id flag if an agent has only one active preview
658
663
  session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring
659
- bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX
664
+ bundle or the published agent, respectively. To find either API name, navigate to your package directory in your DX
660
665
  project. The API name of an authoring bundle is the same as its directory name under the "aiAuthoringBundles" metadata
661
666
  directory. Similarly, the published agent's API name is the same as its directory name under the "Bots" metadata
662
667
  directory.
663
668
 
669
+ Use the --all flag to end all active preview sessions at once. You can combine --all with --api-name or
670
+ --authoring-bundle to end only sessions for a specific agent, or use --all on its own to end every session across all
671
+ agents in the project.
672
+
664
673
  EXAMPLES
665
- End a preview session of a published agent by specifying its session ID and API name ; use the default org:
674
+ End a preview session of a published agent by specifying its session ID and API name; use the default org:
666
675
 
667
676
  $ sf agent preview end --session-id <SESSION_ID> --api-name My_Published_Agent
668
677
 
@@ -675,9 +684,17 @@ EXAMPLES
675
684
  one active session.
676
685
 
677
686
  $ sf agent preview end --authoring-bundle My_Local_Agent
687
+
688
+ End all active preview sessions for a specific agent without prompting:
689
+
690
+ $ sf agent preview end --all --authoring-bundle My_Local_Agent --target-org <target_org> --no-prompt
691
+
692
+ End all active preview sessions across every agent in the local session cache for an org:
693
+
694
+ $ sf agent preview end --all --target-org <target_org>
678
695
  ```
679
696
 
680
- _See code: [src/commands/agent/preview/end.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/preview/end.ts)_
697
+ _See code: [src/commands/agent/preview/end.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/preview/end.ts)_
681
698
 
682
699
  ## `sf agent preview send`
683
700
 
@@ -735,7 +752,7 @@ EXAMPLES
735
752
  $ sf agent preview send --utterance "what can you help me with?" --authoring-bundle My_Local_Agent
736
753
  ```
737
754
 
738
- _See code: [src/commands/agent/preview/send.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/preview/send.ts)_
755
+ _See code: [src/commands/agent/preview/send.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/preview/send.ts)_
739
756
 
740
757
  ## `sf agent preview sessions`
741
758
 
@@ -768,7 +785,7 @@ EXAMPLES
768
785
  $ sf agent preview sessions
769
786
  ```
770
787
 
771
- _See code: [src/commands/agent/preview/sessions.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/preview/sessions.ts)_
788
+ _See code: [src/commands/agent/preview/sessions.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/preview/sessions.ts)_
772
789
 
773
790
  ## `sf agent preview start`
774
791
 
@@ -833,7 +850,7 @@ EXAMPLES
833
850
  $ sf agent preview start --api-name My_Published_Agent
834
851
  ```
835
852
 
836
- _See code: [src/commands/agent/preview/start.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/preview/start.ts)_
853
+ _See code: [src/commands/agent/preview/start.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/preview/start.ts)_
837
854
 
838
855
  ## `sf agent publish authoring-bundle`
839
856
 
@@ -893,7 +910,7 @@ EXAMPLES
893
910
  $ sf agent publish authoring-bundle --api-name MyAuthoringbundle --concise
894
911
  ```
895
912
 
896
- _See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/publish/authoring-bundle.ts)_
913
+ _See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/publish/authoring-bundle.ts)_
897
914
 
898
915
  ## `sf agent test create`
899
916
 
@@ -948,7 +965,7 @@ EXAMPLES
948
965
  $ sf agent test create --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --preview
949
966
  ```
950
967
 
951
- _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/test/create.ts)_
968
+ _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/test/create.ts)_
952
969
 
953
970
  ## `sf agent test list`
954
971
 
@@ -983,7 +1000,7 @@ EXAMPLES
983
1000
  $ sf agent test list --target-org my-org
984
1001
  ```
985
1002
 
986
- _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/test/list.ts)_
1003
+ _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/test/list.ts)_
987
1004
 
988
1005
  ## `sf agent test results`
989
1006
 
@@ -1059,7 +1076,7 @@ FLAG DESCRIPTIONS
1059
1076
  expression when using custom evaluations.
1060
1077
  ```
1061
1078
 
1062
- _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/test/results.ts)_
1079
+ _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/test/results.ts)_
1063
1080
 
1064
1081
  ## `sf agent test resume`
1065
1082
 
@@ -1143,7 +1160,7 @@ FLAG DESCRIPTIONS
1143
1160
  expression when using custom evaluations.
1144
1161
  ```
1145
1162
 
1146
- _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/test/resume.ts)_
1163
+ _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/test/resume.ts)_
1147
1164
 
1148
1165
  ## `sf agent test run`
1149
1166
 
@@ -1227,7 +1244,7 @@ FLAG DESCRIPTIONS
1227
1244
  expression when using custom evaluations.
1228
1245
  ```
1229
1246
 
1230
- _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/test/run.ts)_
1247
+ _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/test/run.ts)_
1231
1248
 
1232
1249
  ## `sf agent test run-eval`
1233
1250
 
@@ -1300,11 +1317,11 @@ EXAMPLES
1300
1317
  $ echo '{"tests":[...]}' | sf agent test run-eval --spec --target-org my-org
1301
1318
  ```
1302
1319
 
1303
- _See code: [src/commands/agent/test/run-eval.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/test/run-eval.ts)_
1320
+ _See code: [src/commands/agent/test/run-eval.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/test/run-eval.ts)_
1304
1321
 
1305
1322
  ## `sf agent trace delete`
1306
1323
 
1307
- Delete agent preview trace files.
1324
+ Delete trace files from an agent preview session.
1308
1325
 
1309
1326
  ```
1310
1327
  USAGE
@@ -1312,28 +1329,34 @@ USAGE
1312
1329
  [--no-prompt]
1313
1330
 
1314
1331
  FLAGS
1315
- -a, --agent=<value> Only delete traces for this agent name (substring match). Matches against the name used when
1316
- starting the session, whether that's an authoring bundle or a published agent API name.
1332
+ -a, --agent=<value> API name of the agent used to filter the list of trace files you want to delete. Matches
1333
+ against the API name used when starting the session, either an authoring bundle or a
1334
+ published agent API name.
1317
1335
  --no-prompt Skip the confirmation prompt and delete immediately.
1318
- --older-than=<value> Only delete traces older than this duration. Accepts a number followed by a unit: m/minutes,
1319
- h/hours, d/days, w/weeks (e.g. 7d, 24h, 2w).
1320
- --session-id=<value> Only delete traces from this session ID.
1336
+ --older-than=<value> Duration used to filter the list of trace files; only files older than the duration are
1337
+ deleted. Accepts a number followed by a unit: m/minutes, h/hours, d/days, w/weeks. Examples:
1338
+ 7d, 24h, 2w.
1339
+ --session-id=<value> Session ID used to filter the list of trace files you want to delete. Use the "agent preview
1340
+ sessions" CLI command to list all known agent preview sessions along with their session IDs.
1321
1341
 
1322
1342
  GLOBAL FLAGS
1323
1343
  --flags-dir=<value> Import flag values from a directory.
1324
1344
  --json Format output as json.
1325
1345
 
1326
1346
  DESCRIPTION
1327
- Delete agent preview trace files.
1347
+ Delete trace files from an agent preview session.
1348
+
1349
+ When you run an agent preview conversation (either interactive or programmatic), trace files are automatically
1350
+ recorded and saved in your local DX project. Use this command to delete some or all of the trace files.
1328
1351
 
1329
- Deletes trace files recorded during agent preview sessions. By default, shows a preview of what will be deleted and
1330
- prompts for confirmation. Use --no-prompt to skip confirmation.
1352
+ By default, this command shows a preview of what will be deleted and prompts for confirmation. Use --no-prompt to skip
1353
+ confirmation.
1331
1354
 
1332
- Without filters, deletes all traces for all agents and sessions. Use flags to narrow the scope: filter by agent name
1333
- (--agent), by session (--session-id), or by age (--older-than).
1355
+ Without filters, this comamnd deletes all trace files for all agents and sessions. Use flags to narrow the scope:
1356
+ filter by agent API name (--agent), by session (--session-id), or by age (--older-than).
1334
1357
 
1335
1358
  EXAMPLES
1336
- Delete all traces for all agents and sessions (with confirmation prompt):
1359
+ Delete all traces for all agents and sessions; prompt for confirmation:
1337
1360
 
1338
1361
  $ sf agent trace delete
1339
1362
 
@@ -1349,29 +1372,31 @@ EXAMPLES
1349
1372
 
1350
1373
  $ sf agent trace delete --older-than 7d
1351
1374
 
1352
- Delete traces older than 24 hours for a specific agent, no prompt:
1375
+ Delete traces older than 24 hours for a specific agent; don't prompt for confirmation:
1353
1376
 
1354
1377
  $ sf agent trace delete --agent My_Agent --older-than 24h --no-prompt
1355
1378
 
1356
- Delete all traces without confirmation:
1379
+ Delete all traces for all agents and sessions; don't prompt for confirmation:
1357
1380
 
1358
1381
  $ sf agent trace delete --no-prompt
1359
1382
  ```
1360
1383
 
1361
- _See code: [src/commands/agent/trace/delete.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/trace/delete.ts)_
1384
+ _See code: [src/commands/agent/trace/delete.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/trace/delete.ts)_
1362
1385
 
1363
1386
  ## `sf agent trace list`
1364
1387
 
1365
- List the trace files that were recorded during all agent preview sessions.
1388
+ List the available trace files that were recorded during all agent preview sessions.
1366
1389
 
1367
1390
  ```
1368
1391
  USAGE
1369
1392
  $ sf agent trace list [--json] [--flags-dir <value>] [--session-id <value>] [-a <value>] [--since <value>]
1370
1393
 
1371
1394
  FLAGS
1372
- -a, --agent=<value> Only show traces for this agent name (substring match). Matches against the name used when
1373
- starting the session, whether that's an authoring bundle or a published agent API name.
1374
- --session-id=<value> Session ID used to filter the list of trace files.
1395
+ -a, --agent=<value> API name of the agent used to filter the list of available trace files. Matches against the
1396
+ API name used when starting the session, either an authoring bundle or a published agent API
1397
+ name.
1398
+ --session-id=<value> Session ID used to filter the list of trace files. Use the "agent preview sessions" CLI
1399
+ command to list all known agent preview sessions along with their session IDs.
1375
1400
  --since=<value> Date used to filter the list of trace files; only those recorded on or after the date are
1376
1401
  listed.
1377
1402
 
@@ -1380,33 +1405,34 @@ GLOBAL FLAGS
1380
1405
  --json Format output as json.
1381
1406
 
1382
1407
  DESCRIPTION
1383
- List the trace files that were recorded during all agent preview sessions.
1408
+ List the available trace files that were recorded during all agent preview sessions.
1384
1409
 
1385
- Lists trace files recorded during agent preview sessions. By default, lists all traces for all agents and all of their
1386
- sessions. Use flags to narrow results: filter by agent name (--agent), by session (--session-id), or by date
1410
+ When you run an agent preview conversation (either interactive or programmatic), trace files are automatically
1411
+ recorded and saved in your local DX project. By default, this command lists all trace files for all agents and all of
1412
+ their sessions. Use flags to narrow results: filter by agent name (--agent), by session (--session-id), or by date
1387
1413
  (--since).
1388
1414
 
1389
1415
  Each row in the output corresponds to one trace file, which in turn corresponds to one agent session. The Agent column
1390
1416
  shows the authoring bundle or API name used when starting the session.
1391
1417
 
1392
1418
  EXAMPLES
1393
- List all traces for all agents and sessions:
1419
+ List all trace files for all agents and sessions:
1394
1420
 
1395
1421
  $ sf agent trace list
1396
1422
 
1397
- List all traces for a specific agent:
1423
+ List all trace files for a specific agent:
1398
1424
 
1399
1425
  $ sf agent trace list --agent My_Agent
1400
1426
 
1401
- List traces for a specific session:
1427
+ List trace files for a specific session:
1402
1428
 
1403
1429
  $ sf agent trace list --session-id <SESSION_ID>
1404
1430
 
1405
- List traces recorded on or after April 20, 2026 (date-only, interpreted as UTC midnight):
1431
+ List trace files recorded on or after April 20, 2026 (date-only, interpreted as UTC midnight):
1406
1432
 
1407
1433
  $ sf agent trace list --since 2026-04-20
1408
1434
 
1409
- List traces recorded on or after a specific UTC time:
1435
+ List trace files recorded on or after a specific UTC time:
1410
1436
 
1411
1437
  $ sf agent trace list --since 2026-04-20T14:00:00Z
1412
1438
 
@@ -1425,11 +1451,11 @@ FLAG DESCRIPTIONS
1425
1451
  (2026-04-20T14:00:00.000Z). The "Recorded At" values shown in the table output are valid inputs.
1426
1452
  ```
1427
1453
 
1428
- _See code: [src/commands/agent/trace/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/trace/list.ts)_
1454
+ _See code: [src/commands/agent/trace/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/trace/list.ts)_
1429
1455
 
1430
1456
  ## `sf agent trace read`
1431
1457
 
1432
- Read and analyze trace files from an agent preview session.
1458
+ Read trace files from an agent preview session.
1433
1459
 
1434
1460
  ```
1435
1461
  USAGE
@@ -1437,43 +1463,58 @@ USAGE
1437
1463
  actions|grounding|routing|errors] [-t <value>]
1438
1464
 
1439
1465
  FLAGS
1440
- -d, --dimension=<option> Dimension to drill into when using --format detail. One of: actions, grounding, routing,
1441
- errors. Required when --format is detail.
1466
+ -d, --dimension=<option> Dimension to drill into when using "--format detail"; used to filter and organize the trace
1467
+ data to answer a specific type of question.
1442
1468
  <options: actions|grounding|routing|errors>
1443
- -f, --format=<option> [default: summary] Output format: summary (default), detail, or raw. Use detail with
1444
- --dimension to drill into a specific aspect of the trace.
1469
+ -f, --format=<option> [default: summary] Output format of the trace data; specifies the level of detail you want
1470
+ in the trace files.
1445
1471
  <options: summary|detail|raw>
1446
- -s, --session-id=<value> (required) Session ID to read traces for.
1447
- -t, --turn=<value> Scope output to this conversation turn number.
1472
+ -s, --session-id=<value> (required) Session ID to read traces for. Use the "agent preview sessions" CLI command to
1473
+ list all known agent preview sessions along with their session IDs
1474
+ -t, --turn=<value> Turn number for which you want trace data. A turn is a single utterance or response in a
1475
+ conversation, starting with 1.
1448
1476
 
1449
1477
  GLOBAL FLAGS
1450
1478
  --flags-dir=<value> Import flag values from a directory.
1451
1479
  --json Format output as json.
1452
1480
 
1453
1481
  DESCRIPTION
1454
- Read and analyze trace files from an agent preview session.
1455
-
1456
- Reads trace files recorded during an agent preview session and outputs them in one of three formats.
1457
-
1458
- **--format summary** (default): A per-turn narrative showing topic routing, actions executed, and the agent's
1459
- response. Use this to quickly understand what happened in a session.
1460
-
1461
- **--format detail**: Diagnostic drill-down into a specific dimension (--dimension required). Filters output to only
1462
- the trace steps relevant to that dimension, minimizing noise.
1463
-
1464
- **--format raw**: Unprocessed trace JSON. Use this as a fallback when the trace schema has changed or you need to
1465
- perform custom analysis.
1466
-
1467
- Available dimensions for --format detail: actions, grounding, routing, errors.
1468
-
1469
- Use --turn N to scope output to a single conversation turn.
1482
+ Read trace files from an agent preview session.
1483
+
1484
+ When you run an agent preview conversation (either interactive or programmatic), trace files are automatically
1485
+ recorded and saved in your local DX project. Each turn (utterance or response) of a conversation creates trace data.
1486
+ Use this command to view trace data for a specific preview session, so you can then analyze the trace data to observe,
1487
+ monitor, investigate, and troubleshoot agent events and behavior.
1488
+
1489
+ Use the --format flag to specify one of these formats of the outputted trace data:
1490
+
1491
+ - summary (Default): A per-turn narrative showing topic routing, actions executed, and the agent's response. Use this
1492
+ to quickly understand what happened in a preview session.
1493
+ - detail: Diagnostic drill-down into a specific dimension. Filters output to only the trace steps relevant to that
1494
+ dimension, minimizing noise.
1495
+ - raw: Unprocessed trace JSON. Use this as a fallback when the trace schema has changed or you need to perform custom
1496
+ analysis.
1497
+
1498
+ If you specify "--format detail", you must also specify a dimension with the --dimension flag. Dimensions are a way to
1499
+ slice and analyze the agent execution trace from a specific angle or concern. Instead of looking at the raw sequence
1500
+ of everything that happened, each dimension filters and organizes the trace data to answer a specific type of
1501
+ question. These are the available dimensions and the information they provide:
1502
+
1503
+ - actions: The actions the agent executed. Includes action name, input parameters, output, and latency. Use this
1504
+ dimension to understand what the agent actually did when answering an utterance in the preview session.
1505
+ - grounding: The reasoning steps used by the LLM. Use this dimension to see how the agent "thought" about the problem
1506
+ - the AI reasoning that determined which actions to take.
1507
+ - routing: How the agent navigated between subagents. Use this dimension to understand conversation flow - when and
1508
+ why the agent switched between different subagents or contexts during the conversation.
1509
+ - errors: Aggregates all errors during the session. Use this dimension to quickly identify and debug issues across all
1510
+ steps.
1470
1511
 
1471
1512
  EXAMPLES
1472
- Show a session summary (all turns):
1513
+ Show a session trace summary for all turns in the session with the specified ID:
1473
1514
 
1474
1515
  $ sf agent trace read --session-id <SESSION_ID>
1475
1516
 
1476
- Show summary for a single turn:
1517
+ Show a trace summary for the second turn (utterance or response) of the conversation:
1477
1518
 
1478
1519
  $ sf agent trace read --session-id <SESSION_ID> --turn 2
1479
1520
 
@@ -1481,7 +1522,7 @@ EXAMPLES
1481
1522
 
1482
1523
  $ sf agent trace read --session-id <SESSION_ID> --format detail --dimension actions
1483
1524
 
1484
- Drill into routing decisions for a specific turn:
1525
+ Drill into routing decisions for the first turn of the conversation:
1485
1526
 
1486
1527
  $ sf agent trace read --session-id <SESSION_ID> --format detail --dimension routing --turn 1
1487
1528
 
@@ -1498,7 +1539,7 @@ EXAMPLES
1498
1539
  $ sf agent trace read --session-id <SESSION_ID> --json
1499
1540
  ```
1500
1541
 
1501
- _See code: [src/commands/agent/trace/read.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/trace/read.ts)_
1542
+ _See code: [src/commands/agent/trace/read.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/trace/read.ts)_
1502
1543
 
1503
1544
  ## `sf agent validate authoring-bundle`
1504
1545
 
@@ -1545,6 +1586,6 @@ EXAMPLES
1545
1586
  $ sf agent validate authoring-bundle --api-name MyAuthoringBundle --target-org my-dev-org
1546
1587
  ```
1547
1588
 
1548
- _See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.38.1/src/commands/agent/validate/authoring-bundle.ts)_
1589
+ _See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.39.1/src/commands/agent/validate/authoring-bundle.ts)_
1549
1590
 
1550
1591
  <!-- commandsstop -->
@@ -1,8 +1,12 @@
1
1
  import { SfCommand } from '@salesforce/sf-plugins-core';
2
- export type AgentPreviewEndResult = {
2
+ import type { Interfaces } from '@oclif/core';
3
+ export type EndedSession = {
3
4
  sessionId: string;
4
5
  tracesPath: string;
5
6
  };
7
+ export type AgentPreviewEndResult = {
8
+ ended: EndedSession[];
9
+ } | EndedSession;
6
10
  export default class AgentPreviewEnd extends SfCommand<AgentPreviewEndResult> {
7
11
  static readonly summary: string;
8
12
  static readonly description: string;
@@ -11,11 +15,33 @@ export default class AgentPreviewEnd extends SfCommand<AgentPreviewEndResult> {
11
15
  static readonly envVariablesSection: import("@oclif/core").HelpSection;
12
16
  static readonly errorCodes: import("@oclif/core").HelpSection;
13
17
  static readonly flags: {
14
- 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
15
- 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
- 'session-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
- 'api-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
- 'authoring-bundle': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ 'target-org': Interfaces.OptionFlag<import("@salesforce/core").Org, Interfaces.CustomOptions>;
19
+ 'api-version': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
20
+ 'session-id': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
21
+ 'api-name': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
22
+ 'authoring-bundle': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
23
+ all: Interfaces.BooleanFlag<boolean>;
24
+ 'no-prompt': Interfaces.BooleanFlag<boolean>;
19
25
  };
20
26
  run(): Promise<AgentPreviewEndResult>;
27
+ private initAgent;
28
+ private endAll;
29
+ /**
30
+ * Path 1: --all + --api-name or --authoring-bundle
31
+ * Ends all sessions for a single specified agent. This is the original behaviour.
32
+ */
33
+ private endAllForAgent;
34
+ /**
35
+ * Path 2: --all alone (no agent identifier).
36
+ * Reads all agents from the local cache via listCachedSessions and ends every session.
37
+ * sessionType 'published' → ProductionAgent (server-side DELETE). 'simulated'/'live' → ScriptAgent (local only).
38
+ * session-meta.json is always present for entries returned by listCachedSessions, so sessionType is always defined.
39
+ */
40
+ private endAllAgents;
41
+ /**
42
+ * Called by endAllForAgent (single specified agent) and endAllAgents (all agents from cache)
43
+ * once ended/failed arrays have been fully aggregated.
44
+ * Throws a partial-failure error if needed; logs success otherwise.
45
+ */
46
+ private finishEndAll;
21
47
  }